美文网首页
阿里云polarDB解决报错“Specified key was

阿里云polarDB解决报错“Specified key was

作者: Devid | 来源:发表于2020-04-07 16:26 被阅读0次

导入数据或者建表时报错

Error 1071: Specified key was too long; max key length is 767 bytes.

解决方法

  1. 在控制台的 参数设置 页面修改 innodb_large_prefix 参数值为 ON 或者 1,然后单击 提交。
  2. 创建表时指定表的Row FormatDynamicCompressed,如下:
create table table_name
(
  id int auto_increment primary key,
  name varchar(255)
) 
ROW_FORMAT=DYNAMIC default charset utf8mb4;

如果已经创建了表,则可以通过以下命令修改:

alter table table_name row_format=dynamic;
alter table table_name row_format=compressed;

参考:RDS MySQL提示“Specified key was too long; max key length is 767 bytes”

相关文章

网友评论

      本文标题:阿里云polarDB解决报错“Specified key was

      本文链接:https://www.haomeiwen.com/subject/keunphtx.html