1. PUBLIC
    2. Stack Overflow
    3. Tags
    4. Users
    5. Jobs
    1. TeamsQ&A for workLearn More

       
11
7

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?

asked Jun 10 '15 at 16:15

8 Answers

15

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.

answered Jun 10 '15 at 21:27
BK435

2,59231324
  •  
    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 
  • 3
    In some cases where I was trying to CONVERT TO CHARACTER SET, I was using MySQL 5.5 where the default ROW_FORMAT for InnoDB was COMPACT. Using ALTER TABLE foo ROW_FORMAT=DYNAMIC, CONVERT TO CHARACTER SET charset did the trick. – Christopher Schultz Jun 29 '17 at 13:24 
14

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;
answered Feb 4 '16 at 14:19

mysql建表问题的更多相关文章

  1. 基于表的数据字典构造MySQL建表语句

    表的数据字典格式如下: 如果手动写MySQL建表语句,确认麻烦,还不能保证书写一定正确. 写了个Perl脚本,可快速构造MySQL脚本语句. 脚本如下: #!/usr/bin/perl use str ...

  2. mysql建表出现Timestamp错误

    mysql建表时如果有两个或以上的字段为Timestamp,那么可能会出现如下错误: Incorrect table definition; there can be only one TIMESTA ...

  3. MySql 建表出现的问题:[ERR] 1064 - You have an error in your SQL syntax; check the manual.......

    使用 MySql 建表出现的问题 在使用 Navicat Premium 运行 sql 语句进行建表时,MySQL 报错如下: 建表语句: DROP DATABASE IF EXISTS javawe ...

  4. MySQL 建表语句 create table 中的列定义

    MySQL 建表语句 create table 中的列定义: column_definition: data_type [NOT NULL | NULL] [DEFAULT default_value ...

  5. 三种常用的MySQL建表语句

    MySQL建表语句是最基础的SQL语句之一,下面就为您介绍最常用的三种MySQL建表语句,如果您对MySQL建表语句方面感兴趣的话,不妨一看. 1.最简单的: CREATE TABLE t1(    ...

  6. 【转载】mysql建表date类型不能设置默认值

    如题,mysql建表date类型的不能设置一个默认值,比如我这样: CREATE TABLE `new_table` ( `biryhday` datetime NULL DEFAULT '1996- ...

  7. Mysql建表通用写法

    Mysql建表通用写法 CREATE TABLE IF NOT EXISTS stu( id ) PRIMARY KEY AUTO_INCREMENT,//主键 自增 stuname ) NOT NU ...

  8. 【记录】Mysql 建表注意事项

    博主最近打算搭建商城,由于之前对建表只有很浅显的理解,没有太过深入了解,建表过程中遇到一些问题,现记录如下, 如有问题请各位留言指正,感激不尽: 建表时设置如何设置联合主键?如下标红处: CREATE ...

  9. MySQL建表DDL规范(欢迎补充)

    MySQL建表DDL规范(欢迎补充) 基本规范: 表名和字段名全大写,一般表名以T开头 脚本需支持可重复执行,带IF NOT EXISTS ,但不可带DROP语句 字符集使用utf8mb4 (CHAR ...

  10. SQL SERVER 生成MYSQL建表脚本

    /****** Object: StoredProcedure [dbo].[GET_TableScript_MYSQL] Script Date: 06/15/2012 13:05:14 ***** ...

随机推荐

  1. 面试经典算法:快速排序Golang实现

    Golang快速排序 定义 快速排序由C. A. R. Hoare在1962年提出.快速排序是对冒泡排序的一种改进,采用了一种分治的策略. 基本思想 通过一趟排序将要排序的数据分割成独立的两部分,其中 ...

  2. py datetime

    python datetime模块strptime/strptime format常见格式命令- [python]2011-12-23   版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本 ...

  3. JavaScript-- 基础知识面试题

    1.JavaScript语言特点 1.弱类型,数据类型由数据的值决定 2.解释性脚本语言--解释器是JS引擎 是浏览器的一部分 3.运行在客户端浏览器上 4.有事件驱动机制(按下鼠标,移动窗口等) 5 ...

  4. mimikatz记录

    mimikatz需要管理员权限运行 vps监听 nc -lvp 4444 服务器管理员权限执行 mimikatz.exe ""privilege::debug"" ...

  5. sql语句查询结果中添加自增列

    SELECT Row_Number() over ( order by getdate() ) as init , * FROM 表名

  6. Join 和 App

    在关系型数据库系统中,为了满足第三范式(3NF),需要将满足“传递依赖”的表分离成单独的表,通过Join 子句将相关表进行连接,Join子句共有三种类型:外连接,内连接,交叉连接:外连接分为:left ...

  7. 第二章 Django之python安装(1)

    Python 安装 Django 由百分百的纯 Python 代码编写而成,因此必须在系统中安装 Python .Django 需要 2.3 或更高版本的 Python.如果使用的是 Linux 或 ...

  8. Linux路径切换命令——directory stack

    操作directory stack一共需要3个命令: dirs .pushd.popd dirs: 显示当前目录栈 pushd: 把目录压栈 popd: 把目录弹栈 dirs 显示目录栈内容,如果没有 ...

  9. Linux命令——gzip、zcat、bzip2、bzcat、tar

    参考:Linux命令——ar 为什么文件要压缩? 当文件过大时,无论是本地做备份,复制都很麻烦,而且还浪费磁盘空间.如果用网络传输,大文件无疑会浪费大量宝贵带宽.文件压缩技术可以有效解决这个问题,但是 ...

  10. 中国大学MOOC课程信息之数据分析可视化二

    版权声明:本文为博主原创文章,转载 请注明出处:https://blog.csdn.net/sc2079/article/details/82318571 - 写在前面 本篇博客继续对中国大学MOOC ...