在学习replication时遇到了如下问题:
![](https://images.cnblogs.com/cnblogs_com/helloyb/418541/o_788e5b7a4be79a9c1439b_960.jpg)
显然看到Slave_IO_Running 为NO 表示有问题;
到日志里查看,错误如下:
position 98
100121 17:09:03 [ERROR] The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the--replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
100121 17:09:03 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000007',position 98
怀疑是server-id的原因。
于是如图:
![The slave I/O thread stops(equal MySQL server ids)](http://blogimg.chinaunix.net/blog/upfile2/100121172656.jpg)
显然, 42和88行都定义了server-id。 于是注释了88行。
操作 vi /etc/my.cnf,找到第88行, 将server-id注释掉
如图:
![The slave I/O thread stops(equal MySQL server ids)](http://blogimg.chinaunix.net/blog/upfile2/100121172850.jpg)
再次查询/etc/my.cnf
![The slave I/O thread stops(equal MySQL server ids)](http://blogimg.chinaunix.net/blog/upfile2/100121173006.jpg)
然后重启mysqld服务,service mysqld restart 问题即可解决
如下显示就表示正常:
![The slave I/O thread stops(equal MySQL server ids)](http://blogimg.chinaunix.net/blog/upfile2/100121173057.jpg)