gpt4 book ai didi

未发送 MySQL 复制更改

转载 作者:行者123 更新时间:2023-11-29 03:13:03 25 4
gpt4 key购买 nike

我只为主服务器上的特定数据库设置了 mysql 复制。

如果我连接到主服务器但没有指定数据库(例如,在连接字符串中或使用 'use database' 命令),语句不会发送到从服务器。这是一个错误??为什么会这样?

例子1

到目前为止没有指定数据库:不会复制

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

例子2

重复

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

最佳答案

不是错误。此行为是 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.

关于未发送 MySQL 复制更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5174327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com