From the main IP 192.168.0.1 IP 192.168.0.2
1. Go to the main library configuration file (192.168.0.1) vi /etc/my.cnf
Add [mysqld] at
server-id = 1 - can not be repeated for each id
log-bin = master-bin - log
Save and exit and restart mysql
2. Authorization to enter the account password from mysql database
. Grant replication slave on * * to 'root'@'slave192.168.0.2' identified by 'root'; set here is the user name and password are root
flush privileges; refresh
Restart mysql, view master status
file-- log file name
position-- log location
3. Go from the server (192.168.0.2)
Modify the configuration file vi /etc/my.cnf
Add [mysqld] at
server-id = 2 - can not be repeated for each id
log-bin = slave-bin - log
The slave master point into the mysql
CHANGE MASTER TO
MASTER_HOST='192.168.0.2',
MASTER_USER='root',
MASTER_PASSWORD='root',
MASTER_LOG_FILE='mysql-bin.000002',----file
MASTER_LOG_POS=120;---position
4.start slave; --- start copying
5.show slave status \ G --- check the running status
slave_io_running: yes slave_sql_running: yes indicates successful synchronizations
May occur no problem: see master-slave can ping each other, pay attention to the correct file and position, consistent with the host user passwords from machine login account.
Specific reference: https://blog.csdn.net/i_bruce/article/details/17055135
Additional references: https://www.cnblogs.com/lay2017/p/9043985.html