mysql 5 同步问题解决方法

Last_IO_Error: The replication receiver thread cannot start because the master has GTID_MODE = ON and this server has GTID_MODE = OFF.

原因:MySQL主从的 MasterSlave 必须 同时开启或者关闭 enforce-gtid-consistencygtid-mode 功能,即要保持一致.

gtid-mode=on
enforce-gtid-consistency=true

ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

原因: 从库已经存在之前的relay log.

使用reset slave语句,清除master信息和relay日志信息,并创建全新的中继日志.

mysql> stop slave;
Query OK, 0 rows affected, 2 warnings (0.00 sec)




mysql> reset slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)




mysql> change master to change master to master_host='10.46.143.59',master_port=3306,master_user='repl',master_password='YiKu2022@!',master_log_file='mysql-bin.000052',master_log_pos=1027010894;
Categories: 数据库运维