遇到的问题:
Slave_IO_Running: Yes
Slave_SQL_Running: No
 
Last_SQL_Errno: 1062
ast_SQL_Error: Could not execute Write_rows event on table mysql.user; Duplicate entry 'localhost-root' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000001, end_log_pos 26243
解决方式:
stop slave;
start slave;
mysql > change master to
master_host='192.168.1.171',master_user='repl',master_password='123456',master_log_file='mysql-bin.000009',master_log_pos=658;
show slave status\G
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

另外:

Slave_SQL_Running: No
1.
程序可能在slave上进行了写操作

2.也可能是slave机器重起后,事务回滚造成的.

一般是事务回滚造成的:
解决办法:
mysql> slave stop;
mysql> set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
mysql> slave start;