高版本mysql向低版本(5.7以下)导入sql时可能会发生此问题
开启索引最大长度
SET GLOBAL INNODB_LARGE_PREFIX = ON;
将表改为动态表
SET GLOBAL innodb_file_format = BARRACUDA;
设值表的行记录格式为Dynamic
创建表时CREATE TABLE `users` (
`username` varchar(50) NOT NULL,
`password` varchar(500) NOT NULL,
`enabled` tinyint(1) NOT NULL,
PRIMARY KEY (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
Specified key was too long; max key length is 767 bytes
原文:https://www.cnblogs.com/jiex123/p/14140247.html