MySQL Master/Slave separation master database configuration 1,/etc/my. cnf master database configuration # generally, www.2cto.com server-id = 1 # Database binlog-do-db = search # Database replicate-ignore-db = that does not need to be copied mysqlreplicate-ignore-db = testreplicate-ignore-db = information_schema # files generated for synchronizing data, serial number from: mysql-bin.000001 start log-bin = mysql-bin 2, restart mysql, log on to Mysql, set the permissions required from the database: can log on from any machine, account/password: slave1/passw0rd grant replication slave, reload, super on *. * to 'slave1 '@' % 'identified by 'Pa Ssw0rd '; 3. Check the status of mysql> show master status; + metric + ---------- + -------------- + ---------------- + | File | Position | Binlog_Do_DB | metric | + metric + ---------- + -------------- + metric + | mysql-bin.000005 | 7657 | search | + metric + ---------- + -------------- + ------------------ + 1 row in set (0.01 sec) -------------------------------------------------- ----------------------------------------------- Slave Database Configuration 1,/etc/my. cnf is configured from the database. because Mysql versions do not support parameters similar to "master-host" since 5.1.7, when you use the configuration file to set master-slave synchronization, the following error occurs: mysqld: unknown variable 'master-host = 127.0.0.1 '# Set the server-id in the configuration file to 2server-id = 2 (it may not work. After you log on to the database, use show variables like 'server _ id. Set global server_id = 2;) # Name of the database to be synchronized replicate-do-db = mydatabase 2. Restart mysql, log on to Mysql, and set synchronization settings, syslog.000001 is the log file, and master_log_pos = 0 is the location where logs are copied, that is, data is synchronized from the 0 position of syslog.000001. log files and line numbers are processed based on the actual situation. mysql> stop slave; query OK, 0 rows affected, 1 warning (0.00 sec) mysql> change master to-> master_host = '2017. 103.8.14 ', master_user = 'slave1', master_password = 'passw0rd ',-> master_log_file = 'mysql-bin.000005', master_log_pos = 7657, master_port = 53306; Query OK, 0 rows affected (0.10 sec) mysql> start slave; Query OK, 0 rows affected (0.00 sec) show slave status \ G; command easier