从MySQL 5.7版本的数据库导出sql文件后,导入到MySQL 5.6版本的数据库中报如下错误
Specified key was too long; max key length is 767 bytes
错误提示索引字段长度首先,最大长度767 bytes
在*.sql文件中增加如下设置:
首先设置MySQL的全局参数innodb_large_prefix=ON,将InnoDB表的索引长度上限扩大到3072个字节
set global innodb_large_prefix = ON;
指定innodb文件格式为Barracuda
set global innodb_file_format=Barracuda;
set global innodb_file_format_max=Barracuda;
最后成功导入