MySQL Master-slave configuration
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