MySQL Master-slave configuration

Source: Internet
Author: User

MySQL Master-slave configuration


    • Configure the Lord's My.cnf

1. Configure the following:

Server-id = 1log-bin=mysql-bin

2. Create a user dedicated to replication synchronization:

Grant Replication Slave on * * to ' backup ' @ ' 172.18.9.99 ' identified by ' 123456 ';

3. Configure the my.cnf from the top

The configuration is as follows:

Server-id = 2 (as long as it is larger than the value of the Lord's Server-id)


4. Successive reboots and

5. Log in to the Lord's MySQL

Mysql>show Master status #记录下file和position的值 to be used for MySQL configuration from;

6. Log in to MySQL from the top, execute the following command:

mysql> change master tomaster_host= '  122.114.34.13 ',               # master's ipmaster_port=3306,                            # mysql Service Port master_user= ' backup ',                       #  User master_password= ' 1234567 ',             for master-slave replication      #  password for master-slave replication user master_log_file= ' mysql-bin.000003 ',     The file value on the     # master master_log_pos=120;                         #  The position value on master Mysql> slave start;                        #  Start slavemysql> show slave status\g;                 #  View the status of slave


See if both slave_io_running and slave_sql_running are Yes (yes configured successfully);

This is the MySQL master-slave configuration is finished!

Test:

This article from the "Shallow faint" blog, please be sure to keep this source http://cuixiang.blog.51cto.com/8204722/1725928

MySQL Master-slave configuration

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.