Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to move a MySQL database from a Linux machine to one running Windows Vista.

Using mysqldump, I've obtained a .sql file, which I have moved to the Windows machine. Whats next?

If I were moving to another Linux machine, one could do this sort of thing:

mysql -u username -p databasename < dumpfile.sql 

Does anyone know of an analogous invocation that works from the Windows command line? Or are there tools to accomplish this?

When I try this type of command from the Windows command line, I get:

'mysql' is not recognized as an internal or external command 

I've also tried:

mysql>  source C:\Stuff\dumpfile.sql 

That gave:

Failed to open file 'C:\Stuff\dumpfile.sql', error: 2 
like image 893
Eric Wilson Avatar asked Aug 21 '09 00:08

Eric Wilson


People also ask

How do I use Mysqldump on Windows?

To dump/export a MySQL database, execute the following command in the Windows command prompt: mysqldump -u username -p dbname > filename. sql . After entering that command you will be prompted for your password.


1 Answers

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.

like image 129
Kibbee Avatar answered Sep 18 '22 11:09

Kibbee