- 解决方法:https://learnku.com/articles/42207#957a22 (只针对innodb engine)( 出现问题的MySQL version:5.5.53,MySQL5.7默认开启innodb_large_prefix)
- 永久生效:改配置文件。临时生效:使用如下命令
--show variables like 'innodb_large_prefix'; --show variables like '%innodb_file_format%'; set global innodb_large_prefix=on; set global innodb_file_per_table=on; set global innodb_file_format=Barracuda;
- innodb_file_per_table:截断/删除表(truncate/drop table)时处理方式不同。开启的话,存储空间会返回给操作系统;如果没有开启的话,system table space会保留存储空间以备后用。2)开启时,每个表单独存储;关闭时,所有数据都存储在共享的空间里(system tablespace) here is file_per_table advantages and disadvantages
- innodb_large_prefix:If
innodb_large_prefix
is enabled (the default), the index key prefix limit is 3072 bytes forInnoDB
tables that use theDYNAMIC
orCOMPRESSED
row format. Ifinnodb_large_prefix
is disabled, the index key prefix limit is 767 bytes for tables of any row format. - InnoDB limit refer to here