0

I have a Win7 machine running PHP/MySQL/Apache and I have MySQL Administrator, MySQL Manager for MySQL installed along with a few other tools like Toad MySQL 6.0...

I was looking for a solution for some utf-8 issues I've been having and the majority of solutions (ie this one) say to run a set of commands such as mysqldump etc... But HOW do I run a command on a windows machine? I've tried executing it as an SQL script, running from the Windows Run command like

"C:\Program Files\MySQL\MySQL Server 5.1\bin\" mysqldump MY_DB -uroot --opt --quote-names --skip-set-charset --default-character-set=latin1 >c:\MY_DB_latin1.sql

but without luck. Any suggestions would be very helpful.

Community
  • 1
  • 1
bikey77
  • 6,384
  • 20
  • 60
  • 86
  • It's difficult to help you when we don't know what the problem really is. Does the command run? Does the command fail? Does it run but not give expected result? What errors do you get? – DaveyBoy May 24 '12 at 09:14
  • It's hard to tell because it gives no output. Nor is the file created at the specified location. – bikey77 May 24 '12 at 09:20

3 Answers3

2

The problem is the space between "C:\Program Files\MySQL\MySQL Server 5.1\bin\" and mysqldump. This should read "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump".

Adding the .exe is optional: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump.exe".

If you want to execute MySQL commands instead of dumping the database you should use mysql.exe: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe". Use the -? option to get an overview of the command line options.

Matijs
  • 2,533
  • 20
  • 24
  • Ok, thanks for that. I'll give it a try again. Please let me know what tool you use for running a command in mysql on your local machine. Thanks again. – bikey77 May 24 '12 at 09:20
0

you have a space before mysqldump which is not required.

Also it should be mysqldump.exe

Nir
  • 24,619
  • 25
  • 81
  • 117
0

Win+R -> cmd -> OK
is a Windows command line.

Here you can type (assuming that C:\Program Files\MySQL\MySQL Server 5.1 is a correct path to your MySQL directory and MY_DB is your database name): "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump.exe" MY_DB -uroot --opt --quote-names --skip-set-charset --default-character-set=latin1 >c:\MY_DB_latin1.sql

Here, you'll be able to see the output (most likely you will need -uroot -p, because your root account is password-protected, isn't it?). If you'd like to paste a command, right-click and select "Paste" - Ctrl-V won't work here.

CamaroSS
  • 493
  • 2
  • 6
  • 16