mysql建表问题
- PUBLIC
- Stack Overflow
- Tags
- Users
- Jobs
- TeamsQ&A for workLearn More
When I run a program which does something with MySQL, I got this error message:
2015-06-10 15:41:12,250 ERROR app.wsutils 419 INCRON: Error: ('HY000', '[HY000] [MySQL][ODBC 5.2(w) Driver][mysqld-5.7.7-rc-log]Index column size too large. The maximum column size is 767 bytes. (1709) (SQLExecDirectW)')
I Googled a little bit, and found this error might be relating to the innodb_large_prefix option. However, I am using MySQL 5.7.7 rc, which has already set innodb_large_prefix to be "ON" (checked in MySQL Workbench), allowing up to 3072 bytes. I am not sure if that is the problem with innodb_large_prefix or not.
Anyway, does anyone have an idea how to fix this problem?
- What does your program do? – Barranka Jun 10 '15 at 16:26
- I have no idea... do some creations of tables or calculations? I am just a front end user... – user3570615 Jun 10 '15 at 17:40
Your column that you are trying to index is too large and your settings must not be correct for innodb_large_prefix. There are a couple prerequisites parameters that also have to be set in order for innodb_large_prefix to work correctly.
You can check to make sure that innodb_large_prefix is set by running:
show global variables like 'innodb_lar%';
Here are a couple prerequisites for using innodb_large_prefix:
You need to set your global variable innodb_file_format=BARRACUDA
to check settings run: show global variables like 'innodb_fil%';
At the table level you have to use ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED
for Innodb, rows are stored in COMPACT format (ROW_FORMAT=COMPACT) by default.
- How do you do that "At the database level"? Perhaps you mean
SET GLOBAL? – Rick James Jun 11 '15 at 0:55 - You better configure these settings in my.cnf or else they are stored in memory and hence lost when restarting MySQL/MariaDB. – Braek Aug 18 '15 at 8:40
- @RickJames - Yes doing this at a database level is enough. Infact, doing it at the particular table level also will solve the problem. – Sasank Mukkamala Feb 4 '16 at 14:17
- @Sasank, Rick was just being picky about the word usage... – BK435 Feb 5 '16 at 0:43
- 3In some cases where I was trying to
CONVERT TO CHARACTER SET, I was using MySQL 5.5 where the defaultROW_FORMATfor InnoDB wasCOMPACT. UsingALTER TABLE foo ROW_FORMAT=DYNAMIC, CONVERT TO CHARACTER SET charsetdid the trick. – Christopher Schultz Jun 29 '17 at 13:24
With the help of the answer given by BK435, I did the following and solved the problem.
set global innodb_file_format = BARRACUDA;
set global innodb_large_prefix = ON;
create table test (........) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
- 4As of MariaDB 10.2.2, of course :) You can also set
SET GLOBAL innodb_default_row_format = 'DYNAMIC';– Adam May 21 '18 at 11:15 - Thnx Adam! innodb_default_row_format = DYNAMIC worked for me! +1 – Tobias Gaertner Sep 18 '18 at 7:42
mysql建表问题的更多相关文章
- 基于表的数据字典构造MySQL建表语句
表的数据字典格式如下: 如果手动写MySQL建表语句,确认麻烦,还不能保证书写一定正确. 写了个Perl脚本,可快速构造MySQL脚本语句. 脚本如下: #!/usr/bin/perl use str ...
- mysql建表出现Timestamp错误
mysql建表时如果有两个或以上的字段为Timestamp,那么可能会出现如下错误: Incorrect table definition; there can be only one TIMESTA ...
- MySql 建表出现的问题:[ERR] 1064 - You have an error in your SQL syntax; check the manual.......
使用 MySql 建表出现的问题 在使用 Navicat Premium 运行 sql 语句进行建表时,MySQL 报错如下: 建表语句: DROP DATABASE IF EXISTS javawe ...
- MySQL 建表语句 create table 中的列定义
MySQL 建表语句 create table 中的列定义: column_definition: data_type [NOT NULL | NULL] [DEFAULT default_value ...
- 三种常用的MySQL建表语句
MySQL建表语句是最基础的SQL语句之一,下面就为您介绍最常用的三种MySQL建表语句,如果您对MySQL建表语句方面感兴趣的话,不妨一看. 1.最简单的: CREATE TABLE t1( ...
- 【转载】mysql建表date类型不能设置默认值
如题,mysql建表date类型的不能设置一个默认值,比如我这样: CREATE TABLE `new_table` ( `biryhday` datetime NULL DEFAULT '1996- ...
- Mysql建表通用写法
Mysql建表通用写法 CREATE TABLE IF NOT EXISTS stu( id ) PRIMARY KEY AUTO_INCREMENT,//主键 自增 stuname ) NOT NU ...
- 【记录】Mysql 建表注意事项
博主最近打算搭建商城,由于之前对建表只有很浅显的理解,没有太过深入了解,建表过程中遇到一些问题,现记录如下, 如有问题请各位留言指正,感激不尽: 建表时设置如何设置联合主键?如下标红处: CREATE ...
- MySQL建表DDL规范(欢迎补充)
MySQL建表DDL规范(欢迎补充) 基本规范: 表名和字段名全大写,一般表名以T开头 脚本需支持可重复执行,带IF NOT EXISTS ,但不可带DROP语句 字符集使用utf8mb4 (CHAR ...
- SQL SERVER 生成MYSQL建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_MYSQL] Script Date: 06/15/2012 13:05:14 ***** ...
随机推荐
- CentOS7.5 安装MySql教程
CentOS7位安装MySql教程 1.先检查系统是否装有mysql rpm -qa | grep mysql 2.下载mysql的repo源 wget http://repo.mysql.com/m ...
- Markdown中有序列表和无序列表
最近有用户问我,在简书写 Markdown, 一条有序列表 item 之后接一条无序列表 item,为什么 parse 的结果,第二个 item 依旧是作为有序列表的第二项显示,带有有序列表的列表符号 ...
- 八、wepy代码规范
变量与方法尽量使用驼峰式命名,并且注意避免使用$开头. 以$开头的标识符为WePY框架的内建属性和方法,可在JavaScript脚本中以this.的方式直接使用,具体请参考API文档. 小程序入口.页 ...
- vue之双向绑定
Vue的一大核心是双向绑定,在2.0中采用数据劫持,用Object.defineProperty实现,但作者已声明在3.0中会采用proxy实现 Object.defineProperty是什么? ...
- 使用nodejs连接mysql数据库实现增删改查
首先要有数据库 使用xampp 或者 phpstudy 可以傻瓜式安装 新建一个项目文件夹 之后在这个目录下初始化package.json (npm init) 先在项目中安装mysql 和 ex ...
- BPM软件_财务报销流程管理解决方案_K2工作流引擎
财务报销,对任何企业都是日常运营中重要的一个环节.但报销流程周期长,反复签字手续繁杂,报销过程不透明 ,单据归档保存.检索困难等问题也让员工头疼.为了解决这些困扰,财务报销流程电子化一时成为热门之选. ...
- post请求body格式
在PostMan中用Post方式,Body有form-data,x-www-form-urlencoded,raw,binary四种. 其中raw又分以下7种. 现在来区分一下: form-data是 ...
- java - day008 - 接口,内部类
接口 作用: 结构设计工具,用来解耦合,需要有子类,隔离具体实现 接口是一个极端的抽象类 用 interface 代替 class 用 implements 代替 extends // 接口中所有东西 ...
- “高可用性”(High Availability)??
“高可用性”(High Availability)通常来描述一个系统经过专门的设计,从而减少停工时间,而保持其服务的高度可用性. 计算机的高可用性 计算机系统的可用性用平均无故障时间(MTTF)来度量 ...
- ubuntu python3虚拟环境
mkvirtualenv flow_chart -p /usr/bin/python3.6 # 命令 环境名 -p python所在路径 pip install -r request ...

