First, the primary database configuration assumes that the primary database IP address is: 192.168.1.1 Modify my.cnf Add configuration under [Mysqld] server-id=1
Log-bin=syslog ##################################### Open Log
Binlog-do-db=cmstop ############################### performing a replicated database
Binlog-ignore-db=mysql ############################# do not perform replicated databases
Binlog-ignore-db=test ############################### do not perform replicated databases
Binlog-ignore-db=information_schema ################### do not perform a replicated database save modify restart MySQL login master server Licensing replication user grant replication Slave on * . * to ' t_user ' @ ' 192.168.1.2 ' identified by ' 123456 ' with GRANT option;
View status show Master status;
Mysql> Show master status;
+---------------+----------+--------------+-------------------------------+
| File | Position | binlog_do_db | binlog_ignore_db |
+---------------+----------+--------------+-------------------------------+
| binlog.000005 | 639 | Cmstop | Mysql,test,information_schema |
+---------------+----------+--------------+-------------------------------+
1 row in Set (0.00 sec) Note file,position value Two, from the database configuration assume that the primary database IP address is: 192.168.1.2 Modify my.cnf Add configuration under [Mysqld] server-id= 2replicate-do-db=cmstop (because MySQL already does not support master-host,master-user similar parameters so do not add these configurations in my.cnf) log in from the database configuration host and other information change master to Master_host= ' 192.168.1.1 ', master_user= ' t_user ', master_password= ' 123456 ', master_log_file= ' syslog.000005 ', master _log_pos=639;start slave; View status show slave status\g; see if there is an error if replication does not succeed the modifiable permission is (Grant Select,insert,update,delete, Replication Slave on * * to ' t_user ' @ ' 192.168.1.2 ' identified by ' 123456 ' with grant option;)