Home > Database > Mysql Tutorial > body text

【MySQL案例】ERROR 1786 (HY000)_MySQL

WBOY
Release: 2016-05-31 08:49:14
Original
991 people have browsed it

1.1.1. ERROR 1786 (HY000)

【环境描述】

msyql5.6.14

【报错信息】

执行create table ... select的时候遇到报错:

db1 [test] [23:01:58]> create tablelgmnr_bak select * from lgmnr;

ERROR 1786 (HY000): CREATE TABLE ... SELECTis forbidden when @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1

【报错原因】

ERROR1786是由于开启了enforce_gtid_consistency=true功能导致的,MySQL官方解释说当启用enforce_gtid_consistency功能的时候,MySQL只允许能够保障事务安全,并且能够被日志记录的SQL语句被执行,像create table ... select 和 create temporarytable语句,以及同时更新事务表和非事务表的SQL语句或事务都不允许执行。

db1 [test] [23:28:28]> show variableslike 'ENFORCE_GTID_CONSISTENCY';

+--------------------------+-------+

| Variable_name            | Value |

+--------------------------+-------+

| enforce_gtid_consistency | ON    |

+--------------------------+-------+

【解决方法】

由于enforce_gtid_consistency参数是只读的,所以必须重启MySQL服务才能是配置生效。

尝试在线动态修改时的报错:

db1 [test] [23:37:56]> set globalenforce_gtid_consistency=true;

ERROR 1238 (HY000): Variable'enforce_gtid_consistency' is a read only variable

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!