How do I import an SQL file to MySQL dump using command line. I am using windows.
5 Answers
Navigate to the directory where you have mysql and issue this command, changing the bold values to your file/database locations.
c:\mysql\bin\> mysql -u USERNAME -p PASSWORD database_name < filename.sql
3 Comments
cblab
I'm not sure about Windows, but under *nix, there shouldn't be any space between
-p and the password.T.Raghavendra
with windows -p password loads the my.inf file. removing the space works.
Vivek
this works fine with windows mysql -u USERNAME -p database_name < filename.sql. After this command you may have to enter your password.
Try like this:
I think you need to use the full path at the command line, something like this, perhaps:
C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < file_name.sql
Refer this link also:
Comments
To dump all databases, use the -all-databases option. With that option, no database needs to be specified.
mysqldump -u username -ppassword –all-databases > dump.sql
1 Comment
PJunior
This is to EXPORT, not to IMPORT.