在 MySQL 主服务器上创建不复制到从服务器的表
我有一些脚本可以在 MySQL master 上创建一个表,用数据填充它,对数据进行一些处理,然后再次删除该表。
我不想将所有这些复制到奴隶身上,因为这是浪费时间。有没有办法告诉从站与此表无关,或者通过在 CREATE TABLE 语句本身中做一些巧妙的事情,或者通过设置一个配置命令来声明类似“不要复制任何以 'temp_' 开头的表” “(表名是动态的,以允许多个用户,但它始终以 temp_ 开头)。
当然,使用合适的临时表是完美的,但不幸的是我需要在一个查询中多次引用该表,而 MySQL 不允许这样做。
I've got bit of script that creates a table on a MySQL master, fills it with data, does some work on the data and then drops the table again.
I don't want all this to be replicated to the slaves, as it is a waste of time. Is there any way to tell the slave to have nothing to do with this table, either by doing something clever in the CREATE TABLE statement itself or by setting a config command that states something like "Don't replicate any table beginning with 'temp_'" (the table name is dynamic to allow for multiple users, but it always starts with temp_).
Of course, using a proper temporary table would be perfect, but unfortunately I need to reference the table multiple times in one query, which MySQL doesn't allow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个选项 为此,
但我不确定你会喜欢这个(需要重新启动)
更多详细信息
there is an option for this,
but i not sure you will prefer this (require restart)
more details
您可以将该表放在另一个数据库中。
然后做这样的声明:
You can put the table in another database.
And then do a statement like: