Database import problem
mysql -u user -ppassword databasename < /pathto_database.sql
I get:
sh: database_name: not found
->
and it stops processing. I have created database_name and it exists.
Can somebody help? I'm running on ubuntu 10.04
4 Replies
Does the user you're using have privileges for the database you're trying to access?
MSJ
@vishalrao:
sh: database_name: not found
This is odd. It indicates that the shell is treating database_name as a command it's trying to run. Does your password end with a semicolon? If so (and if the password is unquoted), the shell is interpreting your command line as two separate commands:
mysql -u user -ppassword
database_name < /path_to_database.sql
I'd suggest running mysql -u user -p databasename < /pathto_database.sql and then typing in your password when prompted. This is generally safer anyway as other users on the machine can see the arguments you used on the command line, thus exposing your password to them.
Thanks a lot!