备份数据
set str_time_first_bit="%time:~0,1%"
if %str_time_first_bit%==" " (
set str_date_time=%date:~0,4%%date:~5,2%%date:~8,2%_0%time:~1,1%%time:~3,2%%time:~6,2%
)else (
set str_date_time=%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%
)
echo "str_date_time"
echo "str_date_time"
"C:Program FilesMySQLMySQL Server 5.6inmysqldump" --opt --single-transaction -h192.168.10.8 -uroot -proot --default-character-set=utf8mb4 -R srface > "C:usrfilesdb_backup\%str_date_time%.sql"
还原数据
"C:srface3.0_jpmysql-5.6.43-winx64inmysql" -h127.0.0.1 -uroot -pGxd1234!@#$ --default-character-set=utf8mb4 srface < C:/Users/peiqiang/Desktop/20200821_175903.sql