Mysql备份代码

set s=%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%

mysqldump -u root -ppasswd test> E:\51MobApp\Mysql\test_%s%_bak.sql

Install.bat:
@echo off

cd /d %~dp0

echo 执行此脚本会清除所有数据

set /p svr=请输入Mysql服务器IP: 

echo mysql -u root -h %svr% -p < All.sql

mysql -u root -h %svr% -p < All.sql

pause

exit

All.sql
DROP DATABASE IF EXISTS test;

CREATE DATABASE test;

USE test;

source test_Dump20110614_01.sql;

commit;

你可能感兴趣的:(mysql备份)