MySQL Master-slave replication

Source: Internet
Author: User

#开启主从复制
# 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

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.