TECHIES WORLD

For Techs.... Techniques.... Technologies....

BashCpanelLinuxMysql

How to exclude table from MySQL replication

MySQL allows the option to exclude certain tables from replication. This tutorial explains the configuration to exclude table from MySQL replication.

Step1: Login to the Server as root via SSH.

Step2: Open the MySQL configuration file.

#vi /etc/my.cnf

Step3: Update the following line and save.

replicate-wild-ignore-table = DB.TABLE

Where db need to be replaced with name of the database and table with the name of the table which excluded.

Step4: Restart MySQL service.

#systemctl restart mysqld

Note: Wildcard expressions are allowed in the configuration.

To exclude all tables in a database,

replicate-wild-ignore-table = DB.%

Where DB need to be replaced with name of the database.

To exclude tables starting with a keyword,

replicate-wild-ignore-table = DB.KEY%

Where DB need to be replaced with name of the database and KEY with the appropriate keyword.

That's all…