简体   繁体   English

警告:选项 --database 已被使用

[英]WARNING: The option --database has been used

Running mysqlbinlog to load up binary logs from one server to another.运行 mysqlbinlog 将二进制日志从一台服务器加载到另一台服务器。

Consistently get message:始终收到消息:

WARNING: The option --database has been used.警告:选项 --database 已被使用。 It may filter parts of transactions, but will include the GTIDs in any case.它可能会过滤部分交易,但在任何情况下都会包含 GTID。

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?好吧,也许这是一个愚蠢的问题,但是我应该如何区分我想要的数据库的“GTID”和我不想要的数据库的“GTID”? 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.尝试添加“--include-gtids”参数,但我认为它需要一个 GTID 列表。 I don't have a list of GTIDs.我没有 GTID 列表。 I have a database.我有一个数据库。 Why is that complicated?为什么这么复杂?

It's complicated because --database doesn't mean what you probably think it means.这很复杂,因为--database并不意味着您可能认为它意味着什么。

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.此选项导致 mysqlbinlog 输出二进制日志(仅限本地日志)中的条目,这些条目发生在 db_name 被 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.如果您使用--database db2 ,则不会包含此内容,因为当此事务写入二进制日志时, db2不是默认数据库。

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 ?如果您使用--database db2是否应该包括由此导致的对db1.mytable的更改?

Trick question: the changes to neither table will be included, because the current default database was db3 .技巧问题:对这两个表的更改不会包括在内,因为当前的默认数据库是db3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM