务上需要支持create table XXX as select * from XXX; 这种创建表的语法,但是MySQL5.7.x版本里面gtid是开启的,会报错

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

官方说明:https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-restrictions.html

CREATE TABLE ... SELECT statements.  CREATE TABLE ... SELECT is not safe for statement-based replication. When using row-based replication, this statement is actually logged as two separate events—one for the creation of the table, and another for the insertion of rows from the source table into the new table just created. When this statement is executed within a transaction, it is possible in some cases for these two events to receive the same transaction identifier, which means that the transaction containing the inserts is skipped by the slave. Therefore, CREATE TABLE ... SELECT is not supported when using GTID-based replication.

解决办法关闭GTID模式:
my.cnf里面修改参数为:

gtid_mode = OFF
enforce_gtid_consistency = OFF

重启MySQL,再次创建成功:

mysql> show variables like '%gtid_mode%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| gtid_mode | OFF |
+---------------+-------+
1 row in set (0.01 sec) mysql> show variables like '%enforce_gtid_consistency%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| enforce_gtid_consistency | OFF |
+--------------------------+-------+
1 row in set (0.01 sec) mysql> create table t1 as select * from BS_CONT;
Query OK, 0 rows affected (0.12 sec)

MySQL错误ERROR 1786 (HY000)解决的更多相关文章

  1. MySQL错误ERROR 2002 (HY000): Can't connect to local MySQL server

    From: http://www.jb51.net/article/56952.htm 这篇文章主要介绍了MySQL错误ERROR 2002 (HY000): Can't connect to loc ...

  2. mysql 错误 ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number 解决办法

    MySQL创建用户(包括密码)时,会提示ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number: 问题原因: ...

  3. 启动mysql错误ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ ( ...

  4. Mysql 错误 ERROR 1 (HY000) at line 1: Can't create/write to file '/home/kaizenly/cfg_dict.csv' (Errcode: 13 - Permission denied)

    [1]问题描述 (1)执行SQL语句: use billing; select * from cfg_dict into outfile '/home/kaizenly/cfg_dict.csv' f ...

  5. Mysql错误:ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

    昨晚添加完索引之后, 查询整表的时候抛出Lock wait timeout exceeded; try restarting transaction, 吓死小白的我, 为什么条件查询可以, 整表查不了 ...

  6. mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决

    mysql安装过程中出现错误ERROR 1820 (HY000): You must SET PASSWORD before executing this statement解决   最近新装好的my ...

  7. 【MySQL案例】ERROR 1786 (HY000)

    1.1.1. ERROR 1786 (HY000) [环境描写叙述] msyql5.6.14 [报错信息] 运行create table ... select的时候遇到报错: db1 [test] [ ...

  8. MySQL显示ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)解决方法

    MySQL显示ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)解决方法 2.4K 解决方法: 第一步cd ...

  9. mysql 链接数满了的错误 ERROR 1040 (HY000): Too many connections

    mysql 链接数满了的错误 ERROR 1040 (HY000): Too many connections 第一种处理方式: ./mysql -u root -p 登录成功后执行以下语句查询当前的 ...

随机推荐

  1. Redis 实战搭建高可用架构

    前言:最近在看关于redis缓存方面的知识,今天就来个 Redis sentinel 高可用架构,实战开始之前,先看看sentinel的概念 什么是redis-sentinel Redis-Senti ...

  2. Mybatis连接MySQL时,可以使用的JDBC连接字符串参数

    一.举例 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test_db?useAffectedRows=true&allowMultiQu ...

  3. 转:Windows系统环境下安装dlib

    原文链接 因为今天安装Face Recognition,需要先按照 dlib .需要在windows环境下做一些图片处理,所以需要在pycharm中配置环境,而其中需要的主要是dlib的安装: 下面说 ...

  4. Java自学-I/O Stream流

    Java的流 Stream 什么是流(Stream),流就是一系列的数据 步骤 1 : 什么是流 当不同的介质之间有数据交互的时候,JAVA就使用流来实现. 数据源可以是文件,还可以是数据库,网络甚至 ...

  5. 开发技术--pandas模块

    开发|pandas模块 整了一篇关于pandas模块的使用文章,方便检查自己的学习质量.自从使用了pandas之后,真的是被它的功能所震撼~~~ 前言 目前所有的文章思想格式都是:知识+情感. 知识: ...

  6. Ivanti的垃圾软件landesk

    landesk是Ivanti公司推出的终端管理工具,这个工具垃圾就垃圾在无法卸载,进程杀不死.文件删不掉,奉劝大家千万不要安装这个软件.前些天公司的IT部门一直在催促员工安装这个软件,我一时糊涂安装了 ...

  7. CentOS 7.0 使用yum 安装 Mariadb

    第一步: 使用命令查看是否已经安装: mysql -u root -p 返回 Enter password:  时表示已经安装成功的,需要卸载安装. 第二步: 使用yum直接安装mariadb,注意带 ...

  8. es严格模式、对象和扩展。

    01. 严格模式 1. 理解: * 除了正常运行模式(混杂模式),ES5添加了第二种运行模式:"严格模式"(strict mode). * 顾名思义,这种模式使得Javascrip ...

  9. 某安全设备未授权访问+任意文件下载0day

    具体是哪家就不说了,硬件盒子,主要检测病毒. payload如下: https://xxx.xxx.xxx.xxx/downTxtFile.php?filename=/etc/passwd 比较简单, ...

  10. python处理excel函数xlrd、xlwt

    https://www.jianshu.com/p/f2c9dff344c6 https://www.cnblogs.com/ilovepython/p/11068841.html 行列操作:http ...