How do you create a .bat file to run a MYSQLDUMP on all Databases?
Posted on 2011-04-21
I am trying to create a .bat file that will run the mysqldump.exe file and do a dump of the database to c:\mySqlDumps folder. I can get this to work manually from the command prompt with the following:
mysqldump --all-databases > c:\mySqlDumps\mySQLBugDump.sql
However, I would like a .bat file for this as I plan on setting up a scheduled job to run the .bat file and have our backup software run a backup of the dump file. The script I have in my .bat file is:
@echo off START C:\program files\mysql\mysql server 5.1\bin\mysqldump.exe --all-databases > C:\mysqldumps\mySQLBugDump.sql;
This produces the mySQLBugDump.sql file in the c:\mysqldumps directory but it is only 1KB in size (cpmpared to 30MB when I run the mysqldump command manually).
Any help resolving this would be greatly appreciated. Thanks!