#主库修改my. INI[mysqld]Server-Id=2Log-Bin=Mysql-Binbinlog-Do-Db=demo# modifying My.ini from a library[mysqld]Server-Id=3Replicate-Do-Db=Demo--Restart master and slave libraries after configuration is complete#主库为从库添加用户Grant ReplicationSlave,reload,super on *.* toSlave@14.23.88. theIdentified by '123456', show master status, query host file/Postin+------------------+----------+--------------+------------------+-------------------+| File |Position|binlog_do_db|binlog_ignore_db|Executed_gtid_set|+------------------+----------+--------------+------------------+-------------------+|Mysql-Bin.000004 | 722 |Demo| | |+------------------+----------+--------------+------------------+-------------------+1Rowinch Set(0.01sec) #从库 detect whether the main library can be connected to ensure that the master-slave communication Stop Slave; Turn off slave sync connection change master toMaster_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;--Initiate a slave-to- machine step connectionShow slave status--View StatusWaiting forMaster toSend Event14.23.88.110Slave4569 -Mysql-Bin.000004 154DELL-Pc-Relay-Bin.000004 367Mysql-Bin.000004Yes Yes Demo0 0 154 623None0No0No0 0 2Ebd6ae04-6e14-11e8-b39c-444553544f53 C:\ProgramData\MySQL\MySQL Server5.7\data\master.info0Slave hasRead AllRelayLog; Waiting forMore Updates86400 0
MySQL master-Slave library synchronization