1, respectively open the host and slave my.cnf command to set
Vim/etc/my.cnf
Under [mysqld], fill in the numbers yourself, but not repeat them.
Log-bin
Server-id=?
2, in the host to operate, into the MySQL
Host gives slave permission: Grant replication slave, replication client on * * to ' rep ' @ ' slave IP ' identified by ' password '; Rep can set its own
Refresh permissions: Flush privileges;
Then turn off MySQL and refresh the systemctl restart Mysqld
3. Re-enter MySQL and enter show master status; Get for example mysqld-bin.000001 409 of these 2 numbers
4. Enter MySQL from the machine
Change Master to master_host= ' host IP ', master_user= ' rep ', Master_password = ' password ', master_log_file= ' master1-bin.000009 ', master_log_pos=154;
Rep is just a host set of master1-bin.000009 and 154 just got from the host, all need to be replaced from the host to get the number
5, stop Slave;
6, start slave;
7, show slave status\g; show waiting for Master to send event succeeds
MySQL master-slave separation under CentOS