Preparations for the mysql replication official Chinese documents: 1. Ensure that the mysql versions on the Master and Slave hosts are consistent to avoid unnecessary troubles. 2. Ensure that the Master/Slave can ping each other and communicate with each other. Master Host IP: 192.168.1.1 Slave Host IP: 192.168.1.2 Configure my. ini: Master-my. ini added under [mysqld]: log-bin = mysql-bin # because MYSQL is synchronized based on binary logs, the size of each log file is 1G server-id = 1 # service identification number of the main label, binlog-do-db = db_user # Name of the database to be synchronized binlog-do-db = db_topic binlog-ignore-db = mysql, test # database that does not record logs, that is, the database Slave-my. add ini under [mysqld: server-id = 2 log-bin = mysql-bin # If bidirectional synchronization is not performed, the slave machine does not need to write the binary log-slave-updates master-host = 192.168.1.1 master-user = slave # Master-password = 123456 # master-port = 3306 replicate-ignore-db = mysql # non-synchronous database replicate-do -db = db_user # replicate the database to be synchronized-do-db = db_topic restart Master and Slave # net stop mysql # net start mysql> show master status; # view my. is the ini configured successfully to create an account (Slave access Master) mysql> grant replication slave, reload, super, select on *. * to slave @ '%' identified by '000000'; mysql> flush privileges; back up the database of the Master host (db_user, db_topic) # If the table structure is MyISAM, you can directly copy the file mysql> flush tables with read lock; # lock and prohibit write operations. mysql> mysqldump-uroot-proot-P3306-databases db_user db_topic> backdb. SQL imports Master data to Slave. If the structure of all database tables is MyISAM mysql> load data from master; otherwise, mysql-uroot-proot <backdb. SQL stop Slave mysql> stop slave; tell slave the current master value mysql> change master to master_host = '2017. 168.1.1 ', master_user = 'slave', master_password = '000000', master_port = 123456, master_log_file = 'mysql-bin.000001 ', master_log_pos = 98; mysql> start slave; # Start Synchronous Detection Slave status mysql> show slave status \ G; # When the three most important fields are the following values, Slave_IO_Running: Yes Slave_ SQL _Running: Yes Seconds_Behind_Master: 0 return to the Master machine mysql> unlock tables; # unlock now Master/Slave should be configured, you can try to add a record in the Master db_user, Slave can also select