The MySQL version used here is 5.6.23 and is configured with a new MySQL master-slave copy (no data existed before)
1. Configure Master
VI My.cnflog-bin=mysql-binserver-id=1innodb_flush_log_at_trx_commit=1sync_binlog=1service mysqld Restart
2. Configure slave
VI My.cnfserver-id=2service mysqld Restart
3. Create a user on Master for master-slave replication
mysql> CREATE USER ' repl ' @ '%.mydomain.com ' identified by ' Slavepass ';mysql> GRANT REPLICATION SLAVE on * * to ' REPL ' @ '%.mydomain.com ';
4. Record the master log name and location
Mysql> FLUSH TABLES with READ lock;mysql > SHOW MASTER STATUS; Reopen a session to view the log name and location exit the first session
5. Configure Slave
Mysql> change MASTER to-, master_host= ' master_host_name ', master_user= ' replication_user_name ', -master_password= ' Replication_password ', master_log_file= ' recorded_log_file_name ', M Aster_log_pos=recorded_log_position;
This article is from "My youth I am the Master" blog, please be sure to keep this source http://qikangwei.blog.51cto.com/2282397/1616943
MySQL Master-slave replication