问题

create table: Specified key was too long; max key length is 767 bytes

原因

数据库表采用utf8编码,其中varchar(255)的column进行了唯一键索引
而mysql默认情况下单个列的索引不能超过767位(不同版本可能存在差异) 于是utf8字符编码下,255*3 byte 超过限制 解决 1 使用innodb引擎;
2 启用innodb_large_prefix选项,将约束项扩展至3072byte;
3 重新创建数据库; my.cnf配置:
default-storage-engine=INNODB
innodb_large_prefix=on 一般情况下不建议使用这么长的索引,对性能有一定影响; 参考文档:
https://dev.mysql.com/doc/refman/5.5/en/innodb-restrictions.html
mysql索引限制767字节搞定;
set global innodb_large_prefix=on;
set global innodb_file_format=BARRACUDA;
建表加上row_format=dynamic;
 

【转自】:http://www.cnblogs.com/littleatp/p/4612896.html

【转】mysql 索引过长1071-max key length is 767 byte的更多相关文章

  1. 索引长度过长 ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

    1.发现问题 今天在修改innodb表的某个列的长度时,报如下错误: alter table test2 modify column id varchar(500); ERROR 1071 (4200 ...

  2. mysql 索引过长1071-max key length is 767 byte

    问题 create table: Specified key was too long; max key length is 767 bytes   原因 数据库表采用utf8编码,其中varchar ...

  3. Navicat for Mysql中错误提示索引过长1071-max key length is 767 byte

    1.建用户信息表 tb_person_info create table tb_person_info( user_id int(10) auto_increment, `name` varchar( ...

  4. MySQL 报错:[Err] 1071 - Specified key was too long; max key length is 767 bytes

    [Err] 1071 - Specified key was too long; max key length is 767 bytes 这个会出现在MySQ5.7以下版本 因为没有启用innodb_ ...

  5. ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

    今天在MySQL 5.6版本的数据库中修改InnoDB表字段长度时遇到了"ERROR 1071 (42000): Specified key was too long; max key le ...

  6. laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

    今天在学习laravel的路由模型绑定时,在按照文档执行php artisan migrate时报错. In Connection.php line 664: SQLSTATE[42000]: Syn ...

  7. django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')

    环境介绍 Django (2.1)  Python 3.5.5 mysqlclient (1.4.2.post1) Mysql 5.6.28 RHEL 7.3 在migrate时候报错 model代码 ...

  8. 导入sql文件报错:1071 Specified key was too long; max key length is 767 bytes

    ref: https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-7 ...

  9. 关于MySQL字符集问题:Specified key was too long; max key length is 767 bytes

    [文章来源]http://blog.csdn.net/cindy9902/article/details/6215769 MySQL: ERROR 1071 (42000): Specified ke ...

随机推荐

  1. springmvc概述及框架原理

    一. 前言 MVC不是框架而是一种设计模式. MVC的全名Model View Controller,即模型-视图-控制器的缩写,这是一种设计模式,而非架构.MVC它强制的使用应用程序的输入.处理.和 ...

  2. 【Smali】Smali文件的动态调试

    1.简介 smalidea是一个IntelliJ IDEA/Android Studio smali语言插件,可实现动态调试smali代码.下载地址为:https://github.com/Jesus ...

  3. 【C#】C#项目如何获得项目的根目录

    编写程序的时候,经常需要用的项目根目录.自己总结如下 1.取得控制台应用程序的根目录方法     方法1.Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径 ...

  4. linux 下 pip 安装教程

    方法一: 下载文件 wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate 执行安装 python get-pip.py 这就 ...

  5. numpy 数组迭代Iterating over arrays

    在numpy 1.6中引入的迭代器对象nditer提供了许多灵活的方式来以系统的方式访问一个或多个数组的所有元素. 1 单数组迭代 该部分位于numpy-ref-1.14.5第1.15 部分Singl ...

  6. netty LEAK: ByteBuf.release() was not called before it's garbage-collected

    背景.netty抛出完整的error信息如下: 2018-02-08 14:30:43.098 [nioEventLoopGroup-5-1] ERROR io.netty.util.Resource ...

  7. 目标检测 的标注数据 .xml 转为 tfrecord 的格式用于 TensorFlow 训练

    将目标检测 的标注数据 .xml 转为 tfrecord 的格式用于 TensorFlow 训练. import xml.etree.ElementTree as ET import numpy as ...

  8. mark CodeGenerator

    基础权限开发框架 BMS = Spring boot + Mybatis plus + Shiro     BMS / bms-admin  / src  / main  / java  / com  ...

  9. fcitx五笔的安装[zz]

    Fcitx──小企鹅输入法:Free Chinese Input Toy for X是国产软件的精品,是一个以GPL方式发布的.基于XIM的简体中文输入法集合(原为G五笔),包括五笔.五笔拼音.二笔. ...

  10. mongodb 远程访问配置

    1.首先修改mongodb的配置文件 让其监听所有外网ip 编辑文件:/etc/mongodb.conf 修改后的内容如下: bind_ip = 0.0.0.0 port = 27017 auth=t ...