mysql配置文件开启这两个选项之后才能生成server-uuid ,才能创建主从,并保证每个server-id不一致
log-bin=mysql-bin
server-id=4
删除auto.cnf,因为这个文件保存着之前的server-uuid
show master status;
在从节点执行
change master to master_host=‘192.168.142.141‘,master_port=3336,master_user=‘root‘,master_password=‘0000‘,master_log_file=‘mysql-bin.000003‘,master_log_pos=154;
show slave status;
查看主从是否成功建立,看以下两个选项是否为yes
Slave_IO_Running: Yes
Slave_SQL_Running: Yes