the scheduled backup windows mysql

Scheduled Tasks Calling bat script file to run mysqldump backup

bat command

set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%"
C:\mysql57\bin\mysqldump --opt --single-transaction=TRUE --user=root --password=root --host=127.0.0.1 --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=TRUE --hex-blob --routines --events "tmp_db" > "C:\mysql57\bakdb\tmp_db_%Ymd%.sql"

 

One week once a clean-up old backup files 

forfiles /p "C:\mysql57\bakdb" /m tmp_db_*.sql -d -7 /c "cmd /c del /f @path"

 

Guess you like

Origin www.cnblogs.com/6min/p/10984408.html