UncaAlby
UncaAlby

Reputation: 5354

WARNING: The option --database has been used

Running mysqlbinlog to load up binary logs from one server to another.

Consistently get message:

WARNING: The option --database has been used. It may filter parts of transactions, but will include the GTIDs in any case.

Yah -- OK? So??

Well maybe this is a stupid question, but how am I supposed to distinguish the "GTID" of the database I want from the "GTID" of the database I don't want? In other words, how do I specify transactions to a particular database while shutting off this annoying warning?

Tried adding "--include-gtids" parameter, but I think it wants a list of GTIDs. I don't have a list of GTIDs. I have a database. Why is that complicated?

Upvotes: 1

Views: 987

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562881

It's complicated because --database doesn't mean what you probably think it means.

It does NOT mean only include changes to the named database.

It means:

This option causes mysqlbinlog to output entries from the binary log (local log only) that occur while db_name is been selected as the default database by USE.

For example:

USE db1;
INSERT INTO db2.mytable ...

This will NOT be included if you use --database db2, because db2 wasn't the default database when this transaction was written to the binary log.

Another example:

USE db3;
UPDATE db1.mytable JOIN db2.myothertable
SET db1.col1 = ...,
    db2.col2 = ...;

Should the changes to db1.mytable resulting from this be included if you use --database db2?

Trick question: the changes to neither table will be included, because the current default database was db3.

Upvotes: 2

Related Questions