MySQL5.7 master-slave configuration implementation method, the specific contents are as follows Installation environment: Master: 10.211.55.11, Redhat6.5, MySQL5.7.12 Master's my.cnf configuration: Slave's my.cnf configuration: You can specify which databases need to be replicated and which do not need to be replicated. For example, in my my.cnf configuration, all the commented-out contents are replicated by default. After modifying the my.cnf configuration file, restart the MySQL service on both machines: service mysqld restart. The following operations are more important: 1. Log in with mysql -u root -p; GRANT FILE ON *.* TO 'root'@'10.211.55.12' IDENTIFIED BY '123456'; GRANT REPLICATION SLAVE ON *.* TO 'root'@'10.211.55.12' IDENTIFIED BY '123456'; FLUSH PRIVILEGES; 3. Execute the show master status command, as shown in the figure: Slave machine mysql configuration 1. Log in with mysql -u root -p; mysql> stop slave; mysql> change master to master_host='10.211.55.11',master_user='root',master_password='123456',master_log_file='mysql-bin.000003', master_log_pos=154; mysql> start slave; Notice: 3. Check the slave status, show slave status\G; Note that the "\G" here is to display the formatted result. If there is no error, the slave status result is as shown in the figure: test: Create a database in Master: mysql> create database test; mysql> create table t1 (id int,name varchar(200),createtime timestamp,key(id)); mysql> insert into t1 values (1,'aa',now()); mysql> insert into t1 values (3,'bb',now()); After completing the above operations, switch to the Salve machine to see if it is synchronized. If nothing goes wrong, it should be synchronized immediately. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: How to use dd command in Linux without destroying the disk
>>: How to use localStorage in JavaScript
Preface For a long time, the application and lear...
1. Download the zip installation package Click he...
Pre-installation work: Make sure vmware workstati...
Create a folder Directory structure: dabaots Init...
1. Command Introduction nl (Number of Lines) adds...
Gtid + Mha + Binlog server configuration: 1: Test...
Let's first look at the MySQL official docume...
Use canvas to create graphics and text with shado...
Table of contents first step: The second step is ...
one. wget https://dev.mysql.com/get/mysql57-commu...
The problem is as follows: I entered the command ...
background As the number of application systems c...
This article example shares the specific code of ...
Basics In a relational database, each data table ...
Preface In the springboot configuration file, the...