MySQL 5.6.26主从复制报错1050

一天老大要求做MySQL5.6的数据库的主从复制,,但是报错了,提示1050数据表已存在错误:
 Last_SQL_Errno: 1050
              Last_SQL_Error: Error 'Table 'authWeibo' already exists' on query. Default database: 'novel'. Query: 'CREATE TABLE `authWeibo` (
  `userId` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `unionId` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4'

[root@localhost log]# tailf error.log
2017-08-10 23:19:30 10076 [Note] Slave I/O thread: connected to master 'novelrep@192.168.10.98:3306',replication started in log 'FIRST' at position 4
2017-08-10 23:19:30 10076 [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0
2017-08-10 23:19:30 10076 [Note] Slave SQL thread initialized, starting replication in log 'FIRST' at position 0, relay log './localhost-relay-bin.000001' position: 4
2017-08-10 23:49:50 10076 [ERROR] Slave SQL: Error 'Table 'authWeibo' already exists' on query. Default database: 'novel'. Query: 'CREATE TABLE `authWeibo` (
  `userId` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `unionId` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4', Error_code: 1050
2017-08-10 23:49:50 10076 [Warning] Slave: Table 'authWeibo' already exists Error_code: 1050
2017-08-10 23:49:50 10076 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000073' position 1025057034

解决办法:
slave从库上停止从库复制线程,重置从库复制账户信息和同步失败的binlog文件以及同步失败的binglog位置点:
stop slave;
reset slave;
CHANGE MASTER TO  MASTER_HOST='192.168.10.98',MASTER_PORT=3306,MASTER_USER='novelrep',MASTER_PASSWORD='JuwoSdk21TbUser',master_log_file='mysql-bin.000073
',master_log_pos=1025057034;start slave;show slave status\G
到此同步成功

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/138cf27a342bf13195cc10d8601a3aea.html