主:172.31.32.184
1、授权所有用户可以连接主节点
update user set host='%' where user='root';
flush privileges;
2、主节点在 my.ini 文件新增配置
server-id=1
log-bin=mysql-bin
3、重启服务
net stop mysql
net start mysql
4、为从节点创建账号同步账号,授权
CREATE USER 'slave'@'%' IDENTIFIED BY 'constxiong@123';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'%';
-- GRANT ALL PRIVILEGES ON *.* TO 'slave'@'%';
flush privileges;
5、查看主节点状态
show master status;
从:172.31.32.234
6、my.ini 配置中新增配置
server-id=2
log-bin=mysql-slave-bin
relay_log=edu-mysql-relay-bin
7、重启 mysql 服务
8、配置从节点,从主同步数据
ConstXiong 备案号:苏ICP备16009629号-3