MySQL Configuration master-slave synchronization process record

Source: Internet
Author: User
Tags unique id

Today due to work needs, configuration of the master-slave synchronization, here to record the configuration process for review.

In advance Niang, master-Slave synchronization needs to ensure that the master-slave server MySQL version consistent (my slightly different, master server version 5.5.31, from server version 5.5.19).

1. Initialize the table structure, import all the table structure backup on the primary server to the slave server, then the master server will not do the data modification operation temporarily.

2, download backup files, and import to from the server, there are many ways, here no longer repeat.

3, modify the master server Master MySQL configuration file, turn on the primary server binary log, and set the server unique ID, edit/etc/my.cnf, as shown in:

4, modify the configuration file from the server slave, similar to the above configuration, edit/etc/my.cnf, as shown in:

5, after the modification is completed, restart the MySQL service on the master and slave server, using a command similar to the following (modify the configuration file must be restarted to take effect):

6. Create an account on master server master and authorize slave to log in to MySQL and execute the following command:

GRANT REPLICATION  on *. *  to ' Slavesync '@ '%' by'slave123456'

After you have done this, you can log in to the master server MySQL to see the master status as shown in the following:

After this step is complete, do not manipulate the master server to prevent the master state from changing.

7, configure from the server slave, log on from the server MySQL (requires appropriate permissions), using the following command:

 to Master_host='127.*.*.*', master_user='  Slavesync', Master_password='slave123456', Master_log_ File='mysql-bin.000014', master_log_pos=217924034 ;

8. Check the status of the replication function from the server:

As of here, the master-slave server configuration is complete. The test can attempt to create a new table in a database on the primary server and then view it from the server, and the table will be synchronized.

The testing process does not repeat.

MySQL Configuration master-slave synchronization process record

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.