MySql报错Error 1709: Index column size too large. The maximum column size is 767 bytes

报改错误是因为表的字段索引长度限制,解决办法:
如果是阿里云数据库
1、进入控制台的参数设置里修改参数innodb_large_prefix为ON或者1,然后单击提交参数


修改参数

2、创建表的时候指定表的row_format格式为Dynamic或者Compressed

create table idx_length_test_02
(
  id int auto_increment primary key,
  name varchar(255)
) 
ROW_FORMAT=DYNAMIC default charset utf8mb4;

对已经创建的表,修改表的row_format格式命令如下:

alter table <表名> row_format=dynamic;
alter table <表名> row_format=compressed;

如果不是阿里云数据库则进入数据库操作页输入

set global innodb_file_format = BARRACUDA;

set global innodb_large_prefix = ON;

你可能感兴趣的:(MySql报错Error 1709: Index column size too large. The maximum column size is 767 bytes)