SyntaxStudy
Sign Up
MySQL Replication Filtering
MySQL Advanced 4 min read

Replication Filtering

Replication Filters

Replication filters selectively replicate or ignore specific databases or tables on the replica.

Example
-- Replicate only specific databases (on replica)
CHANGE REPLICATION FILTER REPLICATE_DO_DB = (orders, inventory);
-- Ignore specific tables
CHANGE REPLICATION FILTER REPLICATE_IGNORE_TABLE = (mydb.sessions, mydb.logs);
-- my.cnf alternatives:
-- replicate-do-db     = mydb
-- replicate-ignore-table = mydb.cache_entries
-- View current filters
SELECT * FROM performance_schema.replication_applier_filters;
Pro Tip

Avoid per-database filters when using row-based logging — they can cause inconsistency with cross-DB transactions.