Fatal error:the slave I/O thread stops because master and slave have equal MySQL server IDs
The mosquitoes took a main three this afternoon. From MySQL replication, the result is that all servers are configured to find errors from the following reports
Copy Code code as follows:
last_io_error:fatal error:the slave I/O thread stops because master and slave have MySQL server IDs; These IDs must is different for replication to work (or the--replicate-same-server-id option must is used on slave but th Is does to always make sense; Please check the manual before using it).
The meaning is from the server_id on the same as the Lord, through the view found from the/etc/my.cnf in the server_id=1 this line I did not comment out (in the copy section below I set the server_id), so immediately the line commented out, and then restart MySQL, Find the same mistakes.
Use the following command to view the server_id
Copy Code code as follows:
mysql> Show variables like ' server_id ';
+---------------+-------+
| variable_name | Value |
+---------------+-------+
| server_id | 1 |
+---------------+-------+
1 row in Set (0.00 sec)
Found that MySQL did not update server_id from the my.cnf file, since this can only be manually modified
Copy Code code as follows:
mysql> set global server_id=2; #此处的数值和my. CNF set the same
mysql> slave start;
After this execution, slave returned to normal.
But later, mosquitoes use/etc/init.d/mysqld restart restart the MySQL service, and then look at the slave state, found that the above error, and then see server_id found that the value returned to 1.
After the mosquito again looked at the contents of the/ETC/MY.CNF, to confirm that it should not be the problem of this file, so go to Google to check, see MySQL in the startup will look for/ETC/MY.CNF, datadir/my.cnf,user_home/ My.cnf.
So I carried out
Copy Code code as follows:
Find/-name "MY.CNF"
Incredibly in/usr/local/mysql this directory found my.cnf file, so the mosquito will delete this file, and then restart the MySQL service, found everything back to normal. If someone else is having a similar problem, try this approach.