#grant replication slave on *.* to 'repl'@slave_ip>
#flush tables with read lock; //将mysql锁住不写数据
#show master status;
配置从
首先安装mysql
查看my.cnf,配置server-id=132,要求和主不一样
修改完配置文件后,启动或者重启mysqld服务
#/etc/init.d/mysqld restart //重启服务
#mysql -uroot
stop slave;
change master to master_host='192.168.37.130', master_user='repl', master_password='5650895', master_log_file='zenwen1.000024',master_log_pos=753715;
start slave;
查看报错日志,找原因,如下继续操作
还要到主上执行 unlock tables,解锁
从上执行 mysql -uroot
show slave stauts\G
查看报错日志,发现原因
2018-01-10 14:55:18 4470 [ERROR] Slave I/O: 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. Error_code: 1593