Dave
Dave

Reputation: 6652

MySQL replication changes not being sent

I've setup mysql replication only for a specific database on the master.

If I connect to the master and don't specify a database (e.g. in the connection string or with the 'use database' command) the statement is not sent to the slave. Is this a bug?? Why does this happen?

Example 1

with no db specified up till now: won't replicate

insert into exampledb.mytable values(1,2,3);

Example 2

replicates

use exampeldb;
insert into mytable values(1,2,3);

Upvotes: 2

Views: 210

Answers (1)

The Scrum Meister
The Scrum Meister

Reputation: 30111

Not a bug. This behavior is defined in the MySql docs:

The main reason for this “check just the default database” behavior is that it is difficult from the statement alone to know whether it should be replicated (for example, if you are using multiple-table DELETE or multiple-table UPDATE statements that go across multiple databases). It is also faster to check only the default database rather than all databases if there is no need.

Upvotes: 1

Related Questions