1, edit the master master server my.cnf
VI /ETC/MY.CNF
Add the following content
[mysqld] log-bin=mysql-bin // [must] enable binary logging server-id=222 //[must] server unique ID, default is 1, usually take IP last paragraph
2, modify the MY.CNF configuration from the server
VI /ETC/MY.CNF
Add the following content
[Mysqld]log-bin=mysql-bin //[not required] enable binary log server-id=226 // [must] server unique ID, default is 1, usually take IP last paragraph
3. Restart all master and slave servers
Systemctl Restart Mysqld
4. Log in to the master server and create a master-slave copy Account
Mysql-u root-'slave'@'%'q123456 '// Create a Slave account
5. View server log files and versions
Mysql> Show Master Status\g//with \g executed, otherwise not in format
6. Log in from the server, set slave copy
mysql> Change Master to master_host='190.168.0.150', master_port=3306,
master_user='slave', master_password='q123456'
, master_log_file='mysql-bin.000001', master_log_pos=308;//Pay attention to the master here _log_file and Master_log_pos are the same as the log files and versions of the master server above
mysql> start slave;
7. View slave status
Mysql> Show slave status\g //band on \g execution, otherwise the format is incorrect
MySQL Master-slave replication