阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

MySQL 5.6.26主从复制报错1050

289次阅读
没有评论

共计 1683 个字符,预计需要花费 5 分钟才能阅读完成。

一天老大要求做 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
到此同步成功

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-08/146203.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计1683字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中