In MySQL master-slave replication, the specified data table is copied from the database (database table-level replication)

The configuration of master-slave replication can refer to:

Master-slave synchronization configuration of Mysql database

This article supplements the above configuration methods:

You can specify that the slave database only replicates certain tables of the master database. The method of operation is:

1. First find the configuration file my.ini (Windows) or my.cnf (Linux)

Windows:
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

Linux:
/etc/mysql/my.cnf

2. Insert after [mysqld] in the configuration file

replicate-do-table = 数据库名.数据表名

或者

replicate-wild-do-table = 数据库名.数据表名

For the precautions and detailed usage of this part, please refer to the MySQL manual:

How the server evaluates replication filter rules

Evaluation of Database-Level Replication and Binary Logging Options

Evaluation of table-level copy options

3. Restart the database service

Guess you like

Origin blog.csdn.net/qq_44667259/article/details/123831913