MySql配置主从模式 Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

时间:2023-03-09 07:00:59
MySql配置主从模式 Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

今天在学习MyCat环境搭建的时候,在配置MySql的主从模式,发现slave在配置完毕后,配置的内容全部正确的情况下,报错了?

MySql配置主从模式 Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

 Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

仔细看了下,提示UUID必须不能相同,什么鬼?忽然一想,原来是虚拟机的环境都是从一个母机上克隆下来的,

所以虚拟机上面的mysql环境配置内容肯定都相同,所以导致了他们的UUID相同,

然而我们要配置数据库的主从模式必须不能UUID相同,

解决办法:

在slave虚拟机上,我们把UUID的配置文件删除,然后在重新启动mysql服务就OK了

[root@rebirth ~]# rm -rf /var/lib/mysql/auto.cnf
[root@rebirth ~]# service mysqld restart

这回就全部OK了,

MySql配置主从模式 Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.