MySQLMysql2::Error: Specified key was too long; max key length is 767 bytes
Posted youzhouliu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQLMysql2::Error: Specified key was too long; max key length is 767 bytes相关的知识,希望对你有一定的参考价值。
这个问题可能很多人在安装mysql时都会遇到,也可能遇到的原因也不一致,这里居于自己遇到时的解决方式做一点分享。
在网上查找这个问题的解决方式时,很多查找出来都感觉不能正确解决问题。当然也可能与我遇到的问题的具体情况不一致。
我当时遇到问题的根源:
使用的mysql版本是5.7以下。
解决方式:
安装mysql5.7以上,即可以使用。
但若是使用的就是mysql5.7以下,并且有需要使用一些长字段时,该怎么办?
这时需要看看创建库的collation选项是否支持 utf8mb4_0900_ai_ci选项了,我当时尝试时,遇到如下图的错误,当时没有好的解决办法,就升级数据库了,因为当时用的库是开发库,可以重新安装,若是有重要数据的库,要重新安装时,记得做好备份,或是评估是否确实需要重装。
以上是关于MySQLMysql2::Error: Specified key was too long; max key length is 767 bytes的主要内容,如果未能解决你的问题,请参考以下文章
IDEA错误:Cannot start compilation: the output path is not specified for module "Test". Speci
IDEA错误:Cannot start compilation: the output path is not specified for module "Test". Speci
IDEA错误:Cannot start compilation: the output path is not specified for module "Test". Speci