Purpose: To improve the robustness of the Master/Slave server settings. If the master server fails, the slave server that was originally used as a backup can be upgraded to the new master server. Process user requests separately on the master and slave servers to obtain more
Purpose: To improve the robustness of the Master/Slave server settings. If the master server fails, the slave server that was originally used as a backup can be upgraded to the new master server. Process user requests separately on the master and slave servers to obtain more
Master-slave replication Configuration
Insert into mysql. user (host, user, password) values ("localhost", "rep1", password ("mysql"); flush privileges; grant replication slave on *. * to rep1@192.168.56.129 identified by 'mysql'; mysql> show master status;
Mysqld_safe -- user = mysql & mysql-uroot-pmysql> change master to master_host = '2017. 168.56.128 ', master_user = 'rep1', master_password = 'mysql', master_log_file = 'mysql-bin.000004', master_log_pos = 477;Correct execution before execution
Mysql> start slave;
If the master database server already has user data, perform the following operations when performing master-slave replication.
Mysql> flush tables with read lock; mysql> show master status;Mysql> unlock tables;The operations on the slave server are the same as those in the previous steps. The website space is skipped.
Mysql> create database first_tb; mysql> insert into first_tb values (001, 'myself '); mysql> show databases;You can view from the database that the website space, Hong Kong virtual host, and database have been fully imported.
This article is from the "Old Xu's Private food" blog and will not be reposted!