批处理备份和恢复mysql数据库

备份

set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%"
md "D:\databackup\%Ymd%"
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --opt -Q databasename -uroot -p123456 > D:\databackup\databasename%Ymd%.sql

@echo off
mshta vbscript:msgbox("mysql backup successed!!!",6,"mysql backup")(window.close)

恢复

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" -uroot -p123456 ensjp < D:\databackup\databasename.sql
@echo off
mshta vbscript:msgbox("mysql restore successed!!!",6,"mysql restore")(window.close)

posted on 2015-04-10 15:27  hellofking  阅读(367)  评论(0编辑  收藏  举报

导航