//环境:
centos6 mysql5.1*
//从库不同步了
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.14
Master_User: mysqlback
Master_Port: 1109
Connect_Retry: 60
Master_Log_File: mysql-bin.000507
Read_Master_Log_Pos: 856911140
Relay_Log_File: mysql585small-relay-bin.000480
Relay_Log_Pos: 37873767
Relay_Master_Log_File: mysql-bin.000505
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB: info_lqzcom,info_lqzcom
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error: Query caused different errors on master and slave. Error on master: message (format)='Invalid error code' error code=126 ; Error on slave: actual message='no error', error code=0. Default database: 'info_lqzcom'. Query: 'DELETE FROM `info_lqzcom`.`v9_search` WHERE `siteid` = '1''
Skip_Counter: 0
Exec_Master_Log_Pos: 586717735
Relay_Log_Space: 2506467299
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error: Query caused different errors on master and slave. Error on master: message (format)='Invalid error code' error code=126 ; Error on slave: actual message='no error', error code=0. Default database: 'info_lqzcom'. Query: 'DELETE FROM `info_lqzcom`.`v9_search` WHERE `siteid` = '1''
//思路:跳过此错误 mysql> stop slave; Query OK, 0 rows affected (0.30 sec) mysql> set global sql_slave_skip_counter =1; Query OK, 0 rows affected (0.00 sec) mysql> start slave; Query OK, 0 rows affected (0.02 sec)
mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.1.14 Master_User: mysqlback Master_Port: 1109 Connect_Retry: 60 Master_Log_File: mysql-bin.000507 Read_Master_Log_Pos: 857870426 Relay_Log_File: mysql585small-relay-bin.000480 Relay_Log_Pos: 42007911 Relay_Master_Log_File: mysql-bin.000505 Slave_IO_Running: Yes Slave_SQL_Running: Yes
同步ok!!!
记录一次生产环境下的主从不同步的案例