MySQL queries from MySQL Workbench will not replicate
I am ready to make some changes to the managed database and am not sure if what I wanted to do would replicate correctly, so I ran some tests in a test environment and it turns out they will only be until I do commands from MySQL Workbench.
For example, if you have a named database db_test
and a table in that named database test_a
only has one column id
and I am trying to accomplish this from the toolbox:INSERT INTO db_test.test_a (id) VALUES (114);
I am getting the expected row in the master database, but it never gets replicated to the slave.
When I execute SHOW SLAVE STATUS
- it shows that everything is in order and current. If I then use another SQL client like SequelPro and insert another row in the same way (but obviously a different ID), it gets mapped to the master file and replicated to the slave.
This puzzled me and I am concerned that I want to understand what the difference is, so I can avoid performing actions that are never replicated.
source to share
If you have installed a --replicate-do-db
replication filtering slave for a database db_test
, replication is filtered based on the default database, so make sure you release USE db_test
. This way your client can work differently or you can issue different statements between clients.
Using --replicate-do-db
installed in db_test
on the slave this will replicate:
USE db_test;
INSERT INTO test_a (id) VALUES (114);
but it won't:
USE other_db;
INSERT INTO db_test.test_a (id) VALUES (114);
To get replication to work regardless of the current default database, use --replicate-wild-do-table
to configure the database and table for replication, or not filter at all.
Also, make sure you are connected to the master database server.
source to share