Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

mysql master copies configuration instructions from


Jun 01, 2021 Article blog


Table of contents


MySQL databases support replication of different business scenarios, such as one-way, two-way, chain cascading, ring, and so on. During replication, one server acts as the master server, receiving content updates from the user, while one or more other servers act as slaves, receiving log content from the primary server binlog file, parsing SQL and re-updating to the slave database, bringing the data from the primary slave server into line.

mysql master copy configuration

mysql default profile is /etc/my.cnf

1 Modify the main library profile:

Set the service id and turn on the binary log file.

server-id=1 log-bin=mysql-bin

 mysql master copies configuration instructions from1

2 Restart service: service mysqld restart;

3 Connect mysql to create users, and authorize:

CREATE USER 'zyk'@'132.232.37.228' IDENTIFIED BY 'zyk123'


  GRANT REPLICATION SLAVE ON *.* TO 'zyk'@'132.232.37.228';


  flush privileges

4 View the host master status;

SHOW MASTER STATUS;

 mysql master copies configuration instructions from2

5 Modify the configuration from the library: Modify the service ID to remain unique

 mysql master copies configuration instructions from3

6 Connect the master statement below on the mysql command line. Note that the parameters are derived from the procedure above.

CHANGE MASTER TO MASTER_HOST='cxygg.top', MASTER_USER='zyk', MASTER_PASSWORD='zyk123', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=771;

7 Start from machine mode

start slave;

8 Take a look at the state from the library. Arrow part Ok, generally no problem.

show slave status;  

 mysql master copies configuration instructions from4

The above is W3Cschool编程狮 about mysql master copy configuration, I hope to help you.