在一台已经运行了MySQL 从库的机器上再次部署一个其他业务的mysql slave 从库时,这台slave从库启动的时候和复制的时候报错:1872
[ERROR] Slave SQL: Slave failed to initialize relay log info structure from the repository, Error_code: 1872
Version: '5.6.36-log' socket: '/tmp/mysql5.6.sock' port: 3307 MySQL Community Server (GPL)
2017-08-10 23:12:22 10076 [ERROR] Slave SQL: Slave failed to initialize relay log info structure from the repository, Error_code: 1872
show slave status\G;
报错:
Last_Errno: 1872
Last_Error: Slave failed to initialize relay log info structure from the repository
Skip_Counter: 0
Exec_Master_Log_Pos: 1025057034
原因:检查my.cnf,原来没指定relay_log,mysql默认产生的relay_log名被该server上的另一个mysql slave占用了。
解决办法
1.在my.cnf中添加
relay_log=/data/mysql5.6/relay-bin
2.登陆slave从库
stop slave;
reset slave;
CHANGE MASTER TO MASTER_HOST='192.168.10.98',MASTER_PORT=3306,MASTER_USER='novelrep',MASTER_PASSWORD='Juok21Tbser',master_log_file='mysql-bin.000077
',master_log_pos=1025057034;start slave;show slave status\G;
到此处解决主从复制问题。