#######################
# 主从配置
#######################
mysqladmin -u root password "oids"
GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'oids';


主节点
授权
GRANT REPLICATION CLIENT , REPLICATION SLAVE ON *.* TO 'replication_user'@'10.%' IDENTIFIED BY 'CdFhfeBEI#4!0what';
FLUSH PRIVILEGES ;

日志位置
FLUSH LOGS;
SHOW MASTER STATUS;
+-----------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+-----------------+----------+--------------+------------------+-------------------+
| mybinlog.000006 | 120 | | | |
+-----------------+----------+--------------+------------------+-------------------+


从节点
# 从节点设置,一定记得设置serverid

CHANGE MASTER TO MASTER_USER='replication_user' , MASTER_LOG_FILE='mybinlog.000006', MASTER_PORT=3306 , MASTER_LOG_POS=120, MASTER_HOST='10.76.249.162', MASTER_PASSWORD='CdFhfeBEI#4!0what';