windows下mysql数据备份bat文件

@echo off

forfiles /p "E:\db_backup" /m lpc_backup_*.sql -d -7 /c "cmd /c del /f @path"

set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%"
E:\mysql-5.6.24-win32\bin\mysqldump --opt --single-transaction=TRUE --user=root --password=113506 --host=127.0.0.1 --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=TRUE --routines --events "lpc" > E:\db_backup\lpc_backup_%Ymd%.sql

@echo on

 

你可能感兴趣的:(数据库)