针对mysql建表语句中报索引过长问题

针对mysql建表语句中报索引过长问题

Specified key was too long; max key length is 767 bytes

针对mysql建表语句中报索引过长问题
① 执行
show variables like ‘%innodb_large_prefix%’;
针对mysql建表语句中报索引过长问题
若value值为off,则执行
set global innodb_large_prefix=on;

② 执行
show variables like ‘%innodb_file_format%’;
针对mysql建表语句中报索引过长问题

若innodb_file_format 与innodb_file_format_max 的value值非Barracuda
则执行:
set global innodb_file_format=Barracuda;
set global innodb_file_format_max=Barracuda;

③再在建表语句后添加 ROW_FORMAT=DYNAMIC
如:
针对mysql建表语句中报索引过长问题