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
As the platform continues to grow, the project...
max_allowed_packet is a parameter in MySQL that i...
Today I found a problem in HTML. There are many d...
After the worker process is started, it will firs...
The LIKE operator is used in the WHERE clause to ...
In this system, the # sign represents the root us...
Table of contents Overview 1. Separation of front...
How to uninstall Mysql perfectly? Follow the step...
For detailed documentation on installing the comp...
[mysql] replace usage (replace part of the conten...
MySQL downloads for all platforms are available a...
This article example shares the specific code for...
Table of contents What is an agent Basic knowledg...
Table of contents 1. Overview of MySQL Logical Ar...
1. Still use PHP script to execute. Command line ...