Restoring a database backup within the control panel, mysqli CLI, or phpMyAdmin may fail with the following message:
#1044 – Access denied for user ‘myuser’@’localhost’ to database ‘mynewdb’
A CREATE DATABASE query is issued during database import that cannot succeed due to limited permissions. All databases must be created within the control panel to ensure proper account namespacing is applied.
First create the destination database within the control panel. Next, remove the lines that begin with: CREATE DATABASE and USE. These lines normally occur consecutively.
CREATE DATABASE IF NOT EXISTS `mynewdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
When importing a database in phpMyAdmin select the database in the left panel, then select Import from the tabs in the right panel.
When importing in mysql from the terminal, include the database name, e.g.
mysql -u username -ppassword mynewdb < dbbackup.sql