mysql -uroot -p123456
grant replication slave on *.* to 'myslave'@'192.168.88.%' identified by '123456'; #从数据库同步使用
grant all privileges on *.* to 'mha'@'192.168.88.%' identified by 'manager'; #manager 使用
grant all privileges on *.* to 'mha'@'mysql1' identified by 'manager'; #防止从库通过主机名连接不上主库
grant all privileges on *.* to 'mha'@'slave1' identified by 'manager';
grant all privileges on *.* to 'mha'@'slave2' identified by 'manager';
flush privileges;

show master status;

change master to master_host='192.168.88.10',master_user='myslave',master_password='123456',master_log_file='mysql-bin.000007',master_log_pos=1745;
start slave;

show slave status\G
//确保 IO 和 SQL 线程都是 Yes,代表同步正常。
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
