各位用户为了找寻关于MYSQL主从库不同步故障一例解决方法的资料费劲了很多周折。这里教程网为您整理了关于MYSQL主从库不同步故障一例解决方法的相关资料,仅供查阅,以下为您介绍关于MYSQL主从库不同步故障一例解决方法的详细内容

于是:  1、在主库中创建一个临时库,将需要导入的表文件复制过来  2、执行  create database tmpdb;  create table tmptable;  cp mysql_date_file master_data_file //shell command 复制数据表文件到master data_dir下  insert into master.tmptable select * from tmpdb.tmptable;  执行完后,主库中数据导入正常  再看slave status  show slave status;  发现错误:not found tmpdb.tmptable (大致意思是这个,原来的错误信息没有记录下来)  匆忙中,看show master status 中Master_Log_Pos 标记为$Master_Log_Pos  然后在slave 上 CHANGE MASTER TO MASTER_LOG_POS=$Master_Log_Pos  然后再看show master status,发现有1162错误  到现在发现两边的数据不能同步了  。。。。。。  冥思苦想,不会重新做一遍主从库吧?  mysqlbinlog 我突然想到了它  于是mysqlbinlog --start-position=190000000 --stop-position=200000000 xxx.binlog|grep tmptable  找到了在slave上执行错误的SQL  mysqlbinlog --start-position=190000000 --stop-position=200000000 xxx.binlog|grep tmptable > /tmp/tmpbinlog  vi /tmp/tmpbinlog (find tmptable)  找到错误SQL的下一个# at (一串数字)标记为$NEXT_POS  在slave 上 CHANGE MASTER TO MASTER_LOG_POS=$NEXT_POS  show slave status 显示:  Slave_IO_Running: Yes  Slave_SQL_Running: Yes  哈哈,完成同步。  如果中间碰到1062错误 在slave配置文件中设定slave-skip-errors=1062,重启slave