1。主库执行: test1 create database ; create database  test2; 2 .主从没有延迟后备份,利用从库备份,物理或者逻辑都可以: mysqldump -uroot  -poracle ——single-transaction 主数据=https://www.yisu.com/zixun/2,所有数据库> dump.sql 3 .主库执行: 创建数据库test3; 4 .将主库干掉 5 .从库提升为主库,并且: 创建数据库test4; 6 .利用从库的备份恢复老的主库,并指向新主 这个时候会发现,恢复出来的从库丢失了一个事务test3: mysql>显示数据库; +--------------------+ |数据库 | +--------------------+ | information_schema | 明| | | mysql | | performance_schema | | sakila | |系统 | test1 | | | test2 | | test4 | tt | | 世界| | +--------------------+ 11行集(0.00秒)
# at 836 # 200328,11:23:25 server  id 1573854809,, end_log_pos 901年,CRC32 0 x23ffdc70 ,,,,,,,, GTID ,,, last_committed=4,,,,,,,, sequence_number=5,,,, rbr_only=no SET @@SESSION.GTID_NEXT=, & # 39; 6 f5b02b9 - 1 - f08 - 11 - ea - 9853 - 000 - c2970dcdf: 5 & # 39;/* ! */; # at 901 # 200328,11:23:25 server  id 1573854809,, end_log_pos 998年,CRC32 0 x2f611a1d ,,,,,,,,,,, Query  thread_id=2,,,,, exec_time=4290974348,,,, error_code=0 SET 时间戳=1585365805/* ! */; create database  test3/* ! */;
# at 998 # 200211,,6:19:19 server  id 1051295,, end_log_pos 1063年,CRC32 0 xec9c6a1e ,, GTID ,,, last_committed=5,,,,,,,, sequence_number=6,,,,,, rbr_only=no SET @@SESSION.GTID_NEXT=, & # 39; 4 c312339 ab38 - 11 e9 - 86 - a8 - 000 c29050245:1& # 39;/* ! */; # at 1063 # 200211,,6:19:19 server  id 1051295,, end_log_pos 1160年,CRC32 0 xaccb28ab ,, Query ,, thread_id=2,,,,, exec_time=0,,,,, error_code=0 SET 时间戳=1581373159/* ! */; SET @@session.sql_mode=1151336480/* ! */; create database  test4/* ! */;
<>以前mysql> show master 状态\ G * * * * * * * * * * * * * * * * * * * * * * * * * * *,1只row * * * * * * * * * * * * * * * * * * * * * * * * * * * ,,,,,,,,,,,,文件:mysql-bin.000002 ,,,,,,,,位置:1443 ,,,,Binlog_Do_DB:, Binlog_Ignore_DB:大敌; Executed_Gtid_Set: 1508年,afe9 - 70 a7 - 11 - ea - 8 d70 - 000 c2970dcdf: 1 - 3,,,,,,自己库里执行的事务 4 c312339 ab38 - 11 e9 - 86 - a8 - 000 c29050245:1——主从传递下来的事务 6 f5b02b9 - 1 - f08 11 - ea - 9853 - 000 - c2970dcdf: 1 - 4——自己作为主的时候执行的事务 1,row set 拷贝;(0.00,sec)
<>以前mysql> show master 状态\ G * * * * * * * * * * * * * * * * * * * * * * * * * * *,1只row * * * * * * * * * * * * * * * * * * * * * * * * * * * ,,,,,,,,,,,,文件:mysql-bin.000002 ,,,,,,,,位置:1322 ,,,,Binlog_Do_DB:, Binlog_Ignore_DB:大敌; Executed_Gtid_Set: 4 c312339 ab38 - 11 e9 - 86 - a8 - 000 c29050245:1 - 2, 6 f5b02b9 - 1 - f08 11 - ea - 9853 - 000 - c2970dcdf: 1 - 5 1,row set 拷贝;(0.00,sec)