说明
注:以 utf8mb4 字符集
字符串
类型字段为例。utf8mb4 是 4 字节字符集,默认支持的索引字段最大长度是 191 字符(767 字节 / 4 字节每字符 ≈ 191 字符),因此在
varchar(255)
或
char(255)
类型字段上创建索引会失败。
建表前添加语句
set global innodb_large_prefix = 1;set global innodb_file_per_table = 1;set global innodb_file_format = Barracuda; ROW_FORMAT = DYNAMIC 参考博文: https://blog.csdn.net/kjrim/article/details/115141343
