3

On Debian, I want to import a huge sql file with a command in a bash script. Currently, I use this command:

mysql -u root -p myDatabase < my_backup.sql

But that's not fine in a bash script because it asks for the root password ! I tried to provide it in the command with the -p argument, but it doesn't seems to work... Do someone have a solution ?

Thanks

1 Answer 1

13

There is no space between the "-p" and your password.

Per mysql documentation:

These work:

-uuser_name -ppassword 
-u user_name -ppassword 

This does not:

-u user_name -p password 

http://forums.mysql.com/read.php?10,229253

Sign up to request clarification or add additional context in comments.

2 Comments

I tried mysql -u root -p="mypassword" myDatabase < my_backup.sql, but it denies the access... :(
You need to drop the equals sign and double-quotes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.