Last_Error: Error 'Duplicate entr '1' for key 'PRIMARY '' on query.
MySQL主从同步时出现该错误的解决办法:
【方案A】
[mysqld]
slave_skip_errors = 1062
重启mysql
【方案B】
1、Slave端:
stop slave;
2、Master端:
FLUSH TABLES WITH READ LOCK;
3、Slave端:
CHANGE MASTER TO MASTER_HOST='Master的IP', MASTER_PORT=Master的MySQL端口, MASTER_USER='同步帐号', MASTER_PASSWORD='同步密码', MASTER_LOG_FILE='Master的log-bin-File', MASTER_LOG_POS=Master的log-bin-Position;
start slave;
4、Master端:
UNLOCK TABLES;
推荐使用方案B:)