Weird Problem Importing an SQL database


Since I’ve had a ticket open for 15 hours without a response, and my site has been down for three days, I figured I would post my problem at the forum.

I am trying to import a mysql database that I uploaded to the root directory of my website. I created a mysql host name. I also created the “container” database where the sql file will be imported.

I can log into this database using PHPMYADMIN and also through shell access. So I know my user name and pass are working properly. However, when I try to import my DB using the following shell command (actual values have been replaced), I get the following error:

[grand]$ mysql -h -u myusername -p dreamhostdb_name <
Enter password:
ERROR 1044 (42000) at line 12: Access denied for user
’myusername’@‘’ to database ‘myusername_name’

For some reason, it tries to connect to a database ‘myusername_name’ which is an amalgamation of my user name and the last part of my database name. It is a database that does not and should not exsist.

I am really stumped. I have exported and imported DB’s using DH’s shell access on another account without any problems.

Anyone have any ideas or suggestions?


Have you tried doing it like “-uusername -ppassword -h dbname”?

Check out Gordaen’s Knowledge, the blog, and the MR2 page.


You can’t have a space between the -p and the password. In fact, you can leave out the -p flag and have it manually prompt you for the password if you’re paranoid.