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
Table of contents Quick Start How to use Core Pri...
1. Function : Allows the parent component to inse...
1. Demand The backend provides such data for the ...
Table of contents 1. Eclipse configures Tomcat 2....
Table of contents 1. Communication method between...
Table of contents 1. The origin of tomcat 1. Tomc...
dig - DNS lookup utility When a domain name acces...
What is a primary key? A primary key is a column ...
Table of contents Create a vue + ts project using...
This article mainly introduces the relevant solut...
Searching online for methods to deploy Angular pr...
Adding a network interface to the container 1 Run...
Record lock locks a single index record. Record l...
<style type="text/css"> Copy code ...
Table of contents 1 Review 2 Five strategies for ...