ERROR 1786 (HY000)

【错误代码】

1 ERROR 1786 (HY000): Statement violates GTID consistency: CREATE TABLE ... SELECT.

【原因分析】

是由于启用enforce_gtid_consistency功能导致

1 mysql> show variables like 'enforce_gtid%';
2 +--------------------------+-------+
3 | Variable_name            | Value |
4 +--------------------------+-------+
5 | enforce_gtid_consistency | ON    |
6 +--------------------------+-------+
7 1 row in set (0.01 sec)

而该功能会限制数据库只允许执行被日志记录的语句,该参数值设置说明:

官方原文解释

When enabled, the server enforces GTID consistency by allowing execution of only statements that can be safely logged using a GTID. You must set this option to ON before enabling GTID based replication.

 

Only statements that can be logged using GTID safe statements can be logged when enforce-gtid-consistency is set to ON, so the operations listed here cannot be used with this option:

  • CREATE TABLE ... SELECT statements

  • CREATE TEMPORARY TABLE or DROP TEMPORARY TABLE statements inside transactions

  • Transactions or statements that update both transactional and nontransactional tables. There is an exception that nontransactional DML is allowed in the same transaction or in the same statement as transactional DML, if all nontransactional tables are temporary.

 【解决方法】

通过set global enforce_gtid_consistency=off来修改

转载于:https://www.cnblogs.com/tonnytangy/p/7541757.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值