3

I have automated my mySQL db backup on my Windows 2003 server using AT.exe. I have scheduled a job like this, which is working fine.

AT 23:59 /EVERY:m,t,w,th,f,s,su c:\path\backup.bat

In the backup.bat file, is this line

C:\wamp\bin\mysql\mysql5.5.20\bin\mysqldump -u username -ppassword --result-file="c:\automatedDBBackups\backup.%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%.sql" dbname

I would like to specify a compression format for the output file.

Kuro Neko
  • 795
  • 12
  • 19
jamesTheProgrammer
  • 1,747
  • 4
  • 22
  • 34
  • You can use command-line buckup feature (with compression option) in dbForge Studio for MySQL - http://www.devart.com/dbforge/mysql/studio/mysql-backup.html – Devart Apr 02 '12 at 14:45

2 Answers2

2

I don't think there is anything built into mysqldump, but what you can do is chain a pipe command out to do a zip, after it's complete. Here's an example by using 7-zip's command line.

mysqldump blah blah ... | path/to/7zip/7za a > /path/to/backup/backup.dbname.gz

You should probably put 7za.exe into your PATH environment variable. You can see the full list of the command line options and switches here.

Jordan
  • 31,971
  • 6
  • 56
  • 67
2

You cannot make mysqldump's output as a zip file. You need to install 3rd party command-line zip tools.

dhchen
  • 1,178
  • 2
  • 10
  • 24