您现在的位置是: 首页 > 运维 mysql 索引过长1071-max key length is 767 byte
mysql 索引过长1071-max key length is 767 byte
2020-05-20 【运维】 1718人已围观 3171次浏览
简介mysql 索引过长1071-max key length is 767 byte
问题
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
很赞哦! (0)
相关文章
- Linux 修改默认的 ssh 22 端口
- Linux 常用命令 持续更新中...
- CentOS 7 安装 Golang 环境
- 【Docker】unauthorized: incorrect username or password
- 解决443端口被VMWare Workstation占用
- ElasticSearch安装踩坑指南
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- Oracle ORA-12541:TNS:no listener错误解决方法
- 查看MySQL默认读取的配置文件
- Debian/Ubuntu无netstat命令解决方案
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- nuxt 项目完整部署方案
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
站长推荐
猜你喜欢
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- Linux 服务器之间传输大文件(压缩文件、查看MD5、后台传输)
- SpringBoot 集成 Elasticsearch 7.8.1 出现错误 Factory method 'elasticsearchRestHighLevelClient' threw exception; nested exception is java.lang.NoSuchFieldError: IGNORE_DEPRECATIONS
- Linux no space left on device 出现设备上没有空间问题
- SqlServer字符串处理
- CentOS 安装 Docker
- Linux 查看磁盘、磁盘分区、挂载磁盘、卸载磁盘操作
- Mac降温软件推荐smcFanControl
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- 解决Mac突然没声音的问题