来自MySQL Workbench的MySQL查询不会复制 [英] MySQL Queries from the MySQL Workbench won't replicate

查看:168
本文介绍了来自MySQL Workbench的MySQL查询不会复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在准备对自己管理的数据库进行一些更改,并且不确定要执行的操作是否可以正确复制,因此我在测试环境中运行了一些测试,事实证明它们可以,但前提是我不这样做从MySQL Workbench运行命令.

I am preparing to make some changes to a database I manage and was unsure that what I wanted to do would replicate properly so I ran some tests in a test environment and it turns out they will but only as long as I do not run the commands from the MySQL Workbench.

例如,如果有一个名为db_test的数据库,并且该数据库中名为test_a的表中只有一个列id,而我尝试从工作台执行此操作:INSERT INTO db_test.test_a (id) VALUES (114);

For example if have a database named db_test and a table in that database named test_a having only a single column id and I try to execute this from the workbench: INSERT INTO db_test.test_a (id) VALUES (114);

我在主数据库中得到了预期的行,但是它从未复制到从数据库中.

I get the expected row in the master database, but it never replicates to the slave.

当我执行SHOW SLAVE STATUS时-它表示一切都很好,并且是最新的.如果然后我使用其他SQL客户端(例如SequelPro)并以相同的方式(但显然是不同的ID)插入另一行,则它将在主服务器中显示并复制到从属服务器.

When I perform a SHOW SLAVE STATUS - it shows everything is fine, and current. If I then use a different SQL client such as SequelPro and insert another row the same way (but obviously a different id) it shows in the master and replicates to the slave.

这让我感到困惑,并且担心,因为我想了解两者之间的区别,所以我可以避免执行永远无法复制的动作.

This has me baffled, and concerned as I want to understand what the difference is so I can avoid performing actions that never replicate.

推荐答案

如果已设置

If you have set --replicate-do-db on the slave to filter replication for database db_test, replication is filtered based on the default database, so make sure that you issue USE db_test. Your client may be working differently in this manner, or you may be issuing different statements between clients.

在从站上使用--replicate-do-db设置为db_test,这将复制:

Using --replicate-do-db set to db_test on the slave, this will replicate:

USE db_test;
INSERT INTO test_a (id) VALUES (114);

但这不会:

USE other_db;
INSERT INTO db_test.test_a (id) VALUES (114);

要使复制工作不受当前默认数据库的影响,请使用--replicate-wild-do-table配置数据库和表以进行复制或完全不进行过滤.

To get replication to work regardless of the current default database, use --replicate-wild-do-table to configure the database and table to replicate or don't filter at all.

此外,请确保您已连接到Master数据库服务器.

Also, make sure that you are connected to the Master database server.

这篇关于来自MySQL Workbench的MySQL查询不会复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆