How can I load a mysqldump .sql file to a MySQL database in Windows Vista How can I load a mysqldump .sql file to a MySQL database in Windows Vista windows windows

How can I load a mysqldump .sql file to a MySQL database in Windows Vista


This same type of command should work in windows as well as Linux. Have you tried running this command? What type of error messages are you getting.

I just tested on my local machine with MySQL on Windows XP. The only reason I could see this not working, is that MySQL isn't on your path. If it isn't in your path, you need to specify the whole path of the MYSQL executable, or run it from the directory it's stored in. You could also add the executable to the path if you plan to use the MySQL executable on a regular basis.


See this comment by Jeff Zohrab on the MySQL documentation:

For windows users, use forward slashes for the path delimiters. You also don't need to enclose the path to the file in quotes. E.g., the following works:

mysql> source C:/Documents and Settings/My name here/My Documents/script.sql;

Just in case, for Linux:

mysql> source /path/to/script.sql;


If you get an 'error 2' is because the comand is been executed, so it's not because MysQL is not been found.

The error 2 is because you should use this path: 'C:/Stuff/dumpfile.sql' instead of 'C:\Stuff\dumpfile.sql'

You could also try 'C:\\Stuff\\dumpfile.sql', but the unix like path it's the way to go.

But the easiest way is this:

If the .sql file is in c:\temp, and the MySQL is installed in the default location:

C:\temp>"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe" -u root -p -h localhost myDatabase < myDatabaseDump.sql

Regards.