标签:The ima 文件 bsp 数据库 ack 添加 files back
1、编写执行文件mysql_backup.bat
rem auther:ELSON ZENG
rem date:20191104
rem mysql backup!
@echo off
set mysql_dump="C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe"
set Ymd="%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%%TIME:~0,2%%TIME:~3,2%"
set backup_path="D:\mysql_backup"
rem 删除过期30天前的数据备份
forfiles /p %backup_path%\data /m backup_*.sql -d -30 /c "cmd /c del /f @path"
rem 开始备份
%mysql_dump% -uroot -p123456 -P 3306 --all-databases --routines > "%backup_path%\data\backup_%Ymd%.sql"
set var=%errorlevel%
@echo on
if %var% EQU 0 (
echo "%DATE:~0,4%-%DATE:~5,2%%DATE:~8,2%-%TIME:~0,2%%TIME:~3,2% backup success!" >> %backup_path%\logs\mysql_backup.log
) else (
echo "%DATE:~0,4%-%DATE:~5,2%%DATE:~8,2%-%TIME:~0,2%%TIME:~3,2% backup fail!" >> %backup_path%\logs\mysql_backup.log
)
2. 添加计划任务
我的电脑(右键)-- 管理 -- 任务计划程序 -- 任务计划程序库 -- 创建任务
标签:The ima 文件 bsp 数据库 ack 添加 files back
原文地址:https://www.cnblogs.com/elson-zeng/p/11792825.html