# 定义要备份的数据库,保存文件名为 test.sh
#!/usr/bin/sh
mysqldump -h 127.0.0.1 -uadmin -padmin database1 > 1.sql;
mysqldump -h 127.0.0.1 -uadmin -padmin database12 > 2.sql;
......
# 每天上午 3:03:00 定时执行备份脚本
3 3 * * * /usr/bin/sh test.sh
# 导入备份
mysql -h 127.0.0.1 -uadmin -padmin --default-character-set=utf8 database1 < 1.sql
# 导入报错
ERROR 1840 (HY000) at line 24: GTID_PURGED can only be set when GTID_EXECUTED is empty.
先执行 > reset master
-- END
写的不错,赞助一下主机费
暂无评论~~