做主从同步时出现问题,show slave status显示错误:
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'mysql-bin.000006' at 120, the last event read from './mysql-bin.000006' at 120, the last byte read from './mysql-bin.000006' at 120.
网上搜到很多方法都未能解决,最后搜到外国问答网才知道是mysql的版本问题点此打开,大致意思就是:
主从版本分别为mysql5.5和mysql5.6,mysql5.6的binlog_checksum默认为crc32,而5.6以前的版本binlog_checksum设置为none,或者没有这个配置。
如果主从同步因此而出错,可以stop slave 停掉从库
设置mysql5.5的set global binlog_checksum=NONE;
或者修改到my.cnf binlog_checksum=NONE,
如果你的mysql5.5版本显示ERROR 1193 (HY000): Unknown system variable 'binlog_checksum',那就将mysql5.6的binlog_checksum设置为NONE即可。
设置后,
主:
flush logs;#刷新日志
flush tables with read lock;#锁定所有表
show master statusG #获取二进制日志信息和位置,给从看
unlock tables; #从库开启后解锁表
从:
change master to master_host='', master_user='', master_password='', master_log_file='', master_log_pos=; start slave;
show slave statusG