First set up the MySQL master server:
To create a user from the server on the primary server:
1.grant replication Slave on *.* to 192.168.0.1 identified by ' 1234 ';
#4.1 with this, before you can use file.
#grant file on *.* to 192.168.0.1 identified by ' 1234 ';
#后来我又加了super和client Save permission, you can not add it first. and then try again.
Configuration file:/etc/my.cnf
2. On the primary server
Server-id = 1
Log-bin
binlog-do-db= the name of the database you want to back up, and if you back up multiple databases, repeat this option
binlog-ignore-db= database does not need to be backed up, if you back up multiple databases, repeat this option
3. From the server
Log-bin
server-id=2
Master-host= Host
master-user= User Name
master-password= Password
master-port= Port
replicate-do-db= the name of the database you want to back up, and if you back up multiple databases, repeat this option
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Just as simple as the above configuration is OK.
Related commands on the primary server:
show master status
show slave hosts
show logs
show binlog events
purge logs to 'log_name'
purge logs before 'date'
reset master(老版本flush master)
set sql_log_bin=