解决violation:1071 Specified key was too long, max key length is 767 bytes

如果启用了系统变量innodb_large_prefix(默认启用,注意实验版本为MySQL 5.6.41,默认是关闭的,MySQL 5.7默认开启),则对于使用DYNAMIC或COMPRESSED行格式的InnoDB表,索引键前缀限制为3072字节。如果禁用innodb_large_prefix,则对于任何行格式的表,索引键前缀限制为767字节。

所以要执行以下部分解决

mysql> set global innodb_file_format = BARRACUDA;
Query OK, 0 rows affected (0.00 sec)
mysql> set global innodb_large_prefix = ON;
Query OK, 0 rows affected (0.00 sec)

猜你喜欢

转载自blog.csdn.net/a13568hki/article/details/106736523