SaidbakR
SaidbakR

Reputation: 13544

Restoring a MySQL dump that try to create database in shared host

I have a hosting account at Godaddy. There is automatic MySQL database backup created every day. It is named like database_name.sql.gz.

On another shared host of mine, I tried to restore that dump after decomrssing it i.e make it database_name.sql using the following command throuh and SSH:

 mysql -u *****_root -p *****_htest < database_name.sql

Where ***** is my account's username

I got the following error:

ERROR 1044 (42000) at line 22: Access denied for user '*****_root'@'localhost' to database 'database_name'

From the error message it seems that the dump try to create a database named as the original database and it neglect to restore it to the database *****_htest. Is there any way to make this dump file to be restored to the specified database instead of creating new one?

Upvotes: 2

Views: 302

Answers (1)

SaidbakR
SaidbakR

Reputation: 13544

Finally, I have found the solution, by entering the MySQL console and execute the following command:

# Enter the console
mysql -u *****_root -p

mysql> use *****_htest
mysql> source database_name.sql

That is all!

Upvotes: 2

Related Questions