mysql在执行脚本时,报出了以下错误:

index column size too large. the maximum column size is 767 bytes
原因:
INNODB 引擎,UTF-8,主键字符串 默认最大 767,需要修改
 

解决方案:

1. 对数据库进行设置

set global innodb_file_format = BARRACUDA

set global innodb_large_prefix = ON

 

注意: 在navicat中执行成功,不清楚重启数据库是否还有效

查看是否生效

show variables like 'character%';
show variables like 'collation_%';
show variables like 'innodb_large_prefix';
show variables like 'innodb_file_format';

 

2. 对脚本进行修改,添加ROW_FORMAT=DYNAMIC

create table test (........) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

 

参考文章:

https://stackoverflow.com/questions/30761867/mysql-error-the-maximum-column-size-is-767-bytes

 

转载直接来源:

https://blog.csdn.net/pansanday/article/details/79375833

 

相关文章:

  • 2022-12-23
  • 2022-03-08
  • 2021-12-26
  • 2022-12-23
  • 2021-11-14
  • 2022-02-16
  • 2022-12-23
  • 2021-05-10
猜你喜欢
  • 2021-12-02
  • 2021-07-20
  • 2022-02-27
  • 2021-10-28
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案