批处理备份和恢复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)

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。