Browsed by
Tag: taking regular mysql dumps

Batch script for taking periodic mysql dumps

Batch script for taking periodic mysql dumps

This batch script will be useful when you want to take periodic mysql dumps and archive it.
Change the folder names accordingly if you want to use it.
——————————————————————–
cd wamp\bin\mysql\mysql5.5.8\bin
mysqldump -u root -p password –result-file=”c:\backup%DATE:~4,2%%DATE:~7,2%%DATE:~10,4%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%.sql” <database_name>
cd C:\Program files\Winrar
Winrar       a       c:\RARbackup%DATE:~4,2%%DATE:~7,2%%DATE:~10,4%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%.rar C:\*.sql
cd /
del *.sql
——————————————————————–
Further add this to windows task scheduler or use AT command which is similar to crontab in linux.
Use it as,
AT 2:00 /every:M <script_path>
This will run at 2 AM on every Monday.