The following articles mainly describe the actual operation steps of Mysql replication settings. If you are interested in the actual operation steps related to Mysql replication settings, you can click to view the following articles. The following is a detailed description of the relevant content.
1. Stop the mysql Service
2. Mysql replication sets all mysql files, including data files
3. The my. ini of the master does not need to be modified. The master mode has been configured by default:
- log-bin=mysql-bin
- binlog_format=mixed
- server-id = 1
4. modify my. ini of slave as follows:
Remove the master configuration in step 3 and add the following content:
- server-id = 2
- master-host = localhost
- master-user = replication
- master-password = replication
- master-port = 3306
Replicate-do-db = database that requires Mysql replication settings
- master-connect-retry=10
Modify the port to 3307 and add a replication user for Mysql replication settings.
5. Restart the master and slave databases.
6. If the master is successfully set, run the show master status Command to view the following information:
- +------------------+----------+--------------+------------------+
- | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
- +------------------+----------+--------------+------------------+
- | mysql-bin.000007 | 39259 | | |
- +------------------+----------+--------------+------------------+
- 1 row in set (0.00 sec)
7. If all settings are successful, run the show slave status command in slave. The corresponding configuration parameters are displayed, indicating that both the master and slave are set properly.
8. If you want TO use the change master to command TO modify the corresponding parameters, you must first use the stop slave command TO stop the slave. After the modification is successful, run start slave and start the slave service.
Note: It is most convenient to stop the mysql service directly without the need to lock the table.
The above content is the description of Mysql replication settings, hoping to help you in this regard.