标签:
建立bat文件
需要在bat的同级目录放入7z.dll和7z.exe还有mysqldump.exe这3个文件
echo off cls cd /d %~dp0 rem ===========configure(start)============== set host=127.0.0.1 set user=admin set pass=配置您的MYSQL密码 set dbname=要备份的数据库名 rem ===========configure(end)============== rem set-date-and-time-toYmd-and-His set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%" set h=%time:~0,2% set h=%h: =0% set "His=%h%%time:~3,2%%time:~6,2%" echo %Ymd%%His% rem mysql-dump-start mkdir sqlbak mysqldump -R -h%host% -P3306 -u%user% -p%pass% %dbname%>sqlbak/%dbname%.sql 7z a -txz sqlbak/%dbname%_%Ymd%%His%.xz sqlbak/%dbname%.sql pause
把以上内容保存为BAT,然后放入控制面板里的计划任务设置即可
标签:
原文地址:http://www.cnblogs.com/firadio/p/4982955.html