cd到mysql的datadir数据目录。例:--datadir=/home/mysql3306/mysql3306
数据目录即为/home/mysql3306/mysql3306
例:[root@localhost ~]# cd /home/mysql3306/mysql3306/
[root@localhost mysql3306]# ls
auto.cnf ibdata1 ib_logfile0 ib_logfile1 mysql mysql-bin.000001 mysql-bin.index performance_schema test
[root@localhost mysql3306]# cat auto.cnf
[auto]
server-uuid=36db5bc7-f136-11e7-bd17-000c291e24f7
[root@localhost mysql3306]# mv auto.cnf auto.cnf.bak
[root@localhost mysql3306]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3306.cnf --user=mysql &
将原来的server-uuid先mv掉,然后重新启动mysql会生成新的UUID
克隆的MySQL数据库,在做主从时会报UUID相同的报错。