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.
具体原因:是因为两台服务器是克隆出来,uuid是一样的
启动mysql,然后查询
# 启动mysql 输入密码
cd /usr/local/mysql
./bin/mysql -u root -p
mysql> show variables like 'datadir';
+---------------+------------------------+
| Variable_name | Value |
+---------------+------------------------+
| datadir | /usr/local/mysql/data/ |
+---------------+------------------------+
mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 0eff2534-f39d-11ec-8a20-000c290868b7 |
+--------------------------------------+
1 row in set (0.00 sec)
退出mysql
mysql> exit;
[root@ygt01 mysql]# cd /usr/local/mysql/data/
[root@ygt01 data]# vi auto.cnf
用 0eff2534-f39d-11ec-8a20-000c290868b7 代替auto.cnf的uuid
重启mysql
systemctl restart mysql