Master and slave have equal MySQL server IDs

Source: Internet
Author: User
Tags mysql in thread
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.