#主库修改my.ini[mysqld]server-id=2log-bin=mysql-binbinlog-do-db=demo#从库修改my.ini[mysqld]server-id=3replicate-do-db=demo--配置完成后重启主从库#主库为从库添加用户grant replication slave,reload,super on *.* to slave@14.23.88.110 identified by '123456';show master status; 查询主机file/postin+------------------+----------+--------------+------------------+-------------------+| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |+------------------+----------+--------------+------------------+-------------------+| mysql-bin.000004 | 722 | demo | | |+------------------+----------+--------------+------------------+-------------------+1 row in set (0.01 sec)#从库 检测是否能够连接上主库,保证主从通讯stop slave; 关闭从机同步连接change master to master_host='14.23.88.111',Master_Port=4569,master_user='slave',master_password='123456', master_log_file='mysql-bin.000004',master_log_pos=722;start slave; --启动从机步连接show slave status --查看状态Waiting for master to send event 14.23.88.110 slave 4569 60 mysql-bin.000004 154 DELL-PC-relay-bin.000004 367 mysql-bin.000004 Yes Yes demo 0 0 154 623 None 0 No 0 No 0 0 2 ebd6ae04-6e14-11e8-b39c-444553544f53 C:\ProgramData\MySQL\MySQL Server 5.7\Data\master.info 0 Slave has read all relay log; waiting for more updates 86400 0