Cent os mysql主从同步问题

查看从库报错

 Last_SQL_Error: Could not execute Update_rows event on table bbs.cdb_myposts_21; Can't find record in 'myposts_21', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql_bin.000049, end_log_pos 181827944

解决办法:

一、从主库上查看该语句

[root@ yunwei]#/service/mysql/bin/mysqlbinlog -v --stop-position=181827944 /service/mysql/data/mysql_bin.000049 > /tmp/1.log
[root@ yunwei]#vim /tmp/1.log

mysql> desc myposts_21;

mysql>select * from myposts_21 where uid=1224921 and dateline=1470752289;

二、在从库插入,重启slave进程
INSERT INTO `bbs`.`myposts_21` (`uid`, `tid`, `pid`, `position`, `dateline`, `special`, `fid`) VALUES ('1224921', '9992763', '0', '60', '1470752289', '0', '0');
stop slave;
start slave;



原文地址:https://www.cnblogs.com/jonnter/p/7725220.html