• 凉风有兴,秋月无边, 亏我思娇的情绪好比度日如年。
  • 虽然我不是玉树临风,潇洒倜傥, 可是我有我广阔的胸襟,加强健的臂腕!

windows自动备份mysql数据库bat脚本

技术笔记 villain 2周前 (06-03) 24次浏览 未收录 0个评论

windows自动备份mysql脚本bat
MysqlDump_AutoBackUp.bat:

@echo off
echo Perform backup tasks 
set hour=%time:~0,2%
if "%time:~0,1%"==" " set hour=0%time:~1,1%
set now=%Date:~0,4%%Date:~5,2%%Date:~8,2%%hour%%Time:~3,2%%Time:~6,2%
echo %now%
set host=localhost
set port=3306
set user=root
set pass=rootpass
set dbname=Weekly%backup
set backupfile=D:\mysqlautobackup\%dbname%-%now%.sql
"D:\PHPWEB\MySQL Server 5.6\bin\mysqldump" -h%host% -P%port% -u%user% -p%pass% -c --all-databases > %backupfile%
echo delete files before 30 days
forfiles /p D:\mysqlautobackup /s /m *.sql /d -30 /c "cmd /c del @file /f"
echo Exiting the backup task
ping /n 3 127.0.0.1 >nul
exit

Villain博客 , 版权所有丨如有问题请联系客服QQ:1004619丨
转载请注明windows自动备份mysql数据库bat脚本
喜欢 (0)
[gqakcom@126.com]
分享 (0)

您必须 登录 才能发表评论!