How to import sql file into a bash script
14,601
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
Author by
maxime
Updated on June 04, 2022Comments
-
maxime almost 2 years
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
-
maxime over 10 yearsI tried mysql -u root -p="mypassword" myDatabase < my_backup.sql, but it denies the access... :(
-
Mark Setchell over 10 yearsYou need to drop the equals sign and double-quotes.