bitsCN.com


windows下备份mysql和网站的脚本

最近使用的一个windows下的数据库和网站备份脚本:

set today=%date:~0,4%-%date:~5,2%-%date:~8,2%

for /f %%i in ('dir d:/wamp/bin/mysql/mysql5.5.20/data /ad /b ') do d:/wamp/bin/mysql/mysql5.5.20/bin/mysqldump.exe -u root -proot %%i >d:/wamp/sql/%%i.sql

net stop wampapache

net stop wampmysqld

7z.exe a -tzip d:/wamp.backup/%today%-wamp.zip d:/wamp/ -mx0 -xr!u_mtc -xr!6027 >d:/wamp.backup/%today%-wamp.log

net start wampmysqld

net start wampapache

del /q d:/wamp/sql/*

bitsCN.com
09-12 11:57