1. Create a copy account and grant replication permissions
CREATE USER ' Fansik ' @ ' 10.% ' identified by ' Fansik ';
GRANT REPLICATION SLAVE On * * to [email protected] ' 10.% ';
2. Get the binary name and coordinates of the synchronization
Login database (Root):
Set Read lock
FLUSH TABLES with READ LOCK;
View Log coordinates
SHOW MASTER STATUS;
FILE is the following master_log_file
Position is the following Master_log_pos
3. Export Master All data
Mysqldump--all-databases--master-data-uroot-p > Fansik.db
4. Log in to the database (root) and unlock
UNLOCK TABLES;
5,/etc/my.cnf from the library must have at least the following configuration, Server-id cannot be the same as Master Oh
Span style= "font-family: imitation; Font-size:18px ">[mysqld]
server-id = 811
Span style= "font-family: imitation; font-size:18px ">skip-slave-start=true
read_only=on
relay-log=relay-bin
relay-log-index=relay-bin.index
Remember to restart the library
After modifying the configuration file
6, log in from the database, make the master database information
Mysql> Change MASTER to
Master_host= ' 10.2.4.1 ',
Master_user= ' Fansik ',
Master_password= ' Fansik ',
Master_log_file= ' mysql-bin.000006 ',
master_log_pos=154;
7. Import the information exported from the main library into the database
Mysql-uroot-p < Fansik.db
8, log in from the database, start synchronization
Start slave;
9. Check if the replication status is normal
Slave_io_running:yes
Slave_sql_running:yes
If all is yes the configuration is successful
mysql-5.7.16-linux-glibc2.5-x86_64 streamlined master-slave configuration