目录
定时备份脚本
rem auther:zhyq
rem date:20220929
rem ******Backup MySQL Start******
@echo off
::设置时间变量
set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%"
::创建存储的文件夹
if not exist "C:\mysql_backup" md "C:\mysql_backup"
::执行备份操作
"C:\mysql\mysql-5.7.34-winx64\bin\mysqldump" --opt --user=root --password=1q2w3e4r!Q@W#E$R --host=127.0.0.1 --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=TRUE --routines --events "lk_shovel_digitization" >C:\mysql_backup\backup_lk_shovel_digitization_%Ymd%.sql
::删除三月前的备份数据
forfiles /p "C:\mysql_backup" /m backup_*.sql -d -90 /c "cmd /c del /f @path"
@echo on
rem ******Backup MySQL End******