Home > other >  A master-slave replication
A master-slave replication

Time:10-09

[mysqld]
The log - bin=/var/log/mysql/mysql - bin
Server - id=1
Open gtid # mode
Gtid_mode=ON
Enforce_gtid_consistency=1

Create a log directory
The mkdir/var/log/mysql
Authorization
Chown mysql. Mysql/var/log/mysql
Restart the service
Systemctl restart mysqld
/root @ mysql - master ~ # mysqladmin - uroot -p 'QsgW (=D# F9 & amp; I 'password' QianFeng @ 123 '
Create exclusive user and authorize
Mysql> TO GRANT the REPLICATION SLAVE ON *. * 'repl' @ '%' identified by '123'.
Have the data leads out data
Mysql - uroot - p 'password' - A & gt; A.t xt
From the library validation
Mysql - urepl - p 'QianFeng @ 1234 - hmysql - master
The connection is successful, exit
# # vim/etc/my CNF configuration is added in the configuration file
[mysqld]
Server - id=2
Open gtid # mode
Gtid_mode=ON
Enforce_gtid_consistency=1

Restart the service
Systemctl restart mysqld
In the configuration from the repository
Mysql> CHANGE the MASTER TO
MASTER_HOST='mysql - master,
MASTER_USER='repl,
MASTER_PASSWORD='QianFeng @ 1234,
MASTER_AUTO_POSITION=1;
# MASTER_AUTO_POSITION 1 to automatically identify location point 0 can manually specify

Mysql> Start slave;

CodePudding user response:

Very commonly used command line ah brothers can be accepted
  • Related