日期:2014-05-16  浏览次数:20821 次

MySQL 1236 错误解决方法

由于主服务器异外重启, 导致从报错, 错误如下:
show slave status错误:

mysql> show slave status\G
Master_Log_File: mysql-bin.000288
Read_Master_Log_Pos: 627806304
Relay_Log_File: mysql-relay-bin.000990
Relay_Log_Pos: 627806457
Relay_Master_Log_File: mysql-bin.000288
Slave_IO_Running: No
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: 627806304
Relay_Log_Space: 627806663

?

......
Last_IO_Error: Got fatal error 1236 from master when? reading?data from binary log:
'Client requested master to start? replication from impossible position'

mysql错误日志:

tail /data/mysql/mysql-error.log
111010 17:35:49 [ERROR] Error reading packet from server: Client requested master
 to start replication from impossible position ( server_errno=1236)
111010 17:35:49 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data
from?binary log: 'Client requested master to start replication from impossible
position', Error_code: 1236
111010 17:35:49 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000288',
position 627806304

?

?

[root@db1 ~]# mysqlbinlog /data/mysql/binlog/mysql-bin.000288 > mysql-bin.000288.sql

less mysql-bin.000288.sql
看最后一部分
# at 627625495
#111010 16:35:46 server id 1 end_log_pos 627625631 Query thread_id=45613333
exec_time=32758 error_code=0
SET TIMESTAMP=1318289746/*!*/;
delete from freeshipping_bef_update where part='AR-4006WLM' and code=''
/*!*/;
# at 627625631
#111010 16:35:46 server id 1 end_log_pos 627625751 Query thread_id=45613333
exec_time=32758 error_code=0
SET TIMESTAMP=1318289746/*!*/;
delete from shippingFee_special where part='AR-4006WLM'
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;