#开启主从复制
# Step One: Open the bin log for all MySQL servers:
Log-bin=mysql-bin
# Step Two: Set a unique Server-id value for each server
Server-id=1
# Step three: If a ring-shaped server needs to be added in the configuration file:
#log-slave-updates = On
# Fourth: Create an account on the master server to synchronize the data
#GRANT replication Slave on * * to ' slave ' @ '% ' identified by ' 1234 ';
# Fifth: View the information for the primary server bin log (these two values are logged after execution, and do not do anything to the primary server until the server is configured, because these values change each time the database is manipulated)
#show Master status;
# Step Sixth: Set up from the server:
# Shutdown from server
# Stop Slave
# Start Configuration
#CHANGE Master to master_host= ' home server IP address ', master_user= ' account for synchronizing data on master server ', master_password= ' synced account password ', Master_log_file = ' bin log filename ', master_log_pos=bin the value of position in the log;
# Boot from server
# start Slave;
# See if there is success if Slave_io_running:yes Slave_sql_running:yes stands for success
# Show Slave Status \g
#解决ID冲突的办法: Each server has a different ID: You can set the number of IDs to start with and add a few: Modify the MySQL configuration file:
#auto_increment_increment = 3; Add a few each time
#auto_increment_offset = 1; The first number starts from a few
MySQL Master-slave replication