日期:2014-05-16  浏览次数:20746 次

windows上备份还原mysql脚本
@echo off
set dir=E:\
set time_hh=%time:~0,2%
if /i %time_hh% LSS 10 (set time_hh=0%time:~1,1%)
set filename=%date:~,4%%date:~5,2%%date:~8,2%_%time_hh%%time:~3,2%%time:~6,2%

set local_host=localhost
set local_db=shopex
set local_table=sdb_orders
set local_user=root
set local_passwd=root


set remote_host=localhost
set remote_db=test
set romote_user=root
set remote_passwd=root


mysqldump -h%local_host% --default-character-set=utf8 --net_buffer_length=10240 --skip-lock-tables  -u%local_user% -p%local_passwd%   --where=" acttime<1352276525"  -R %local_db% %local_table%  > %dir%%filename%.sql

mysql -h%remote_host% -u%romote_user% -p%remote_passwd% --default-character-set=utf8 %remote_db% < %dir%%filename%.sql