I saw the database of netizen mysql5.5 on the Internet. After setting the replication filter, the specified database is not replicated to the slave. The solution to this problem is to use Replicate_Wild_Do_Table instead of Replicate_Do_DB.
I don't have a 5.5 environment, so I tested it on 5.7.
1. Set the replication filter to only update the data of db1.
slave:
mysql> stop slave sql_thread; Query OK, 0 rows affected (0.03 sec) mysql> change replication filter replicate_do_db=(db1); Query OK, 0 rows affected (0.01 sec) mysql> start slave sql_thread; Query OK, 0 rows affected (0.02 sec)
2. There is no problem in synchronizing db1 in normal operation
master:
mysql> use db1 Database changed mysql> select * from t1; +------+ | id | +------+ | 1 | | 2 | +------+ 2 rows in set (0.00 sec) mysql> insert into t1 values(3); Query OK, 1 row affected (0.00 sec)
slave:
mysql> use db1 Database changed mysql> select * from t1; +------+ | id | +------+ | 1 | | 2 | | 3 | +------+ 3 rows in set (0.00 sec)3. No problem was found in the cross-database update, indicating that mysql5.7 solved the previous cross-database update problem in 5.5.
master:
mysql> use l5m Database changed mysql> insert into db1.t1 values(4); Query OK, 1 row affected (0.00 sec) mysql> select * from db1.t1; +------+ | id | +------+ | 1 | | 2 | | 3 | | 4 | +------+ 4 rows in set (0.00 sec)
slave:
mysql> select * from t1; +------+ | id | +------+ | 1 | | 2 | | 3 | | 4 | +------+ 4 rows in set (0.00 sec)