jamesTheProgrammer
jamesTheProgrammer

Reputation: 1777

Can I specify a .zip format for a .sql file created from Windows At.exe?

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.

Upvotes: 3

Views: 3110

Answers (2)

dhchen
dhchen

Reputation: 1198

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

Upvotes: 2

Jordan
Jordan

Reputation: 32522

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.

Upvotes: 2

Related Questions