1 row in set (0.00 sec) # 主库10.0.0.2举行授权 mysql> grant replication slave on *.* to "user1"@"10.0.0.%" identified by "123"; mysql> flush privileges; mysql> change master to master_host="10.0.0.3",master_user="user1",master_password="123",master_log_file="3.000001" ,master_log_pos=300; mysql> start slave; mysql> show slave status\G
复制代码
主从库10.0.0.3:
# 检察主库10.0.0.3的binlog日记 [root@localhost ~]# mysql -u root -p mysql> show master status; # 检察binlog日记 +----------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +----------+----------+--------------+------------------+-------------------+ | 3.000001 | 300 | | | | +----------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec) # 主库10.0.0.3举行授权 mysql> grant replication slave on *.* to "user1"@"10.0.0.%" identified by "123"; mysql> flush privileges; mysql> change master to master_host="10.0.0.2",master_user="user1",master_password="123",master_log_file="3.000001" ,master_log_pos=154; mysql> start slave; mysql> show slave status\G