Recently took over a win2003 server, you need to make a backup of mysql
@echooff sethour=%time:~0,2% if"%hour:~0,1%"==" "sethour=0%hour:~1,1% setmin=%time:~3,2% if"%min:~0,1%"==" "setmin=0%min:~1,1% setsecs=%time:~6,2% if"%secs:~0,1%"==" "setsecs=0%secs:~1,1% set"Ymd=%date:~,4%%date:~5,2%%date:~8,2%" setM=%date:~5,2% setD=%date:~8,2% set"Time=%hour%%min%" mysqldump-u[username]-p[dbpwd][dbname]>D:/tmp/[dbname]_%Ymd%%Time%.sql 7zaaD:/db_bak/%M%/%D%/[dbname]_%Ymd%%Time%.7zD:/tmp/[dbname]_%Ymd%%Time%.sql delD:/tmp/[dbname]_%Ymd%%Time%.sql @echoon |
7z compression can use more space (at 7za.exe need to first drag system32 corresponding to the full path or call, etc.), with respect to the tar.gz accounted for only about 75% of its space
winserver scheduled tasks in the Control Panel
The attached linux
USER="[dbuser]" PWD="[dbpwd]"PORT="3306"DB="[dbname]"DAY=`date+%Y%m%d%H%M` YM=`date+%Y%m`D=`date+%d`/usr/bin/mysqldump -u$USER-p$PWD-P$PORT -B$DB>>/tmp/${DB}_$DAY.sql mkdir-p/mysqldata/$YM/$D/ 7zaa/mysqldata/$YM/$D/${DB}_$DAY.7z /tmp/${DB}_$DAY.sql rm-f/tmp/${DB}_$DAY.sql |