MySQL 5.7 到 5.6,出現 Index column size too large. The maximum column size is 767 bytes
MySQL 5.7建表語句:
CREATE TABLE `4dfca143de64f9b67a59f2d4e8dde0e2_51941` (
`姓名` VARCHAR(255) COLLATE utf8mb4_bin NOT NULL,
`年齡` VARCHAR(255) COLLATE utf8mb4_bin NOT NULL,
`住址` VARCHAR(255) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`姓名`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
在MySQL 5.6執行報錯如下:
錯誤程式碼: 1709
Index column size too large. The maximum column size is 767 bytes.
解決辦法:
InnoDB Row Format Overview
Row Format | Compact Storage Characteristics | Enhanced Variable-Length Column Storage | Large Index Key Prefix Support | Compression Support | Supported Tablespace Types | Required File Format |
---|---|---|---|---|---|---|
REDUNDANT | No | No | No | No | system, file-per-table | Antelope or Barracuda |
COMPACT | Yes | No | No | No | system, file-per-table | Antelope or Barracuda |
DYNAMIC | Yes | Yes | Yes | No | file-per-table | Barracuda |
COMPRESSED | Yes | Yes | Yes | Yes | file-per-table | Barracuda |
可以看出,支援innodb_large_prefix的row format只有dynamic 和compressed,而且它們需要的file format必須為Barracuda。
於是,檢視MySQL 5.7的預設引數配置:
mysql> SHOW VARIABLES LIKE '%innodb_version%'\G
*************************** 1. row ***************************
Variable_name: innodb_version
Value: 5.7.20
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE 'innodb_large_prefix'\G
*************************** 1. row ***************************
Variable_name: innodb_large_prefix
Value: ON
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE 'innodb_file_format'\G
*************************** 1. row ***************************
Variable_name: innodb_file_format
Value: Barracuda
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE 'innodb_file_per_table'\G
*************************** 1. row ***************************
Variable_name: innodb_file_per_table
Value: ON
1 row in set (0.01 sec)
檢視MySQL 5.6的預設引數配置:
mysql> SHOW VARIABLES LIKE '%innodb_version%'\G
*************************** 1. row ***************************
Variable_name: innodb_version
Value: 5.6.24
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE 'innodb_large_prefix'\G
*************************** 1. row ***************************
Variable_name: innodb_large_prefix
Value: OFF
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE 'innodb_file_format'\G
*************************** 1. row ***************************
Variable_name: innodb_file_format
Value: Antelope
1 row in set (0.01 sec)
mysql> SHOW VARIABLES LIKE 'innodb_file_per_table'\G
*************************** 1. row ***************************
Variable_name: innodb_file_per_table
Value: ON
1 row in set (0.00 sec)
從以上比較可以看出5.7和5.6之間引數的預設配置區別,然後我們將5.6的引數配置成和5.7一致
mysql> SET GLOBAL innodb_large_prefix=ON;
Query OK, 0 rows affected (0.00 sec)
mysql> SET GLOBAL innodb_file_format=Barracuda;
Query OK, 0 rows affected (0.00 sec)
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> CREATE TABLE `4dfca143de64f9b67a59f2d4e8dde0e2_519411` (
-> `姓名` VARCHAR(255) COLLATE utf8mb4_bin NOT NULL,
-> `年齡` VARCHAR(255) COLLATE utf8mb4_bin NOT NULL,
-> `住址` VARCHAR(255) COLLATE utf8mb4_bin NOT NULL,
-> PRIMARY KEY (`姓名`)
-> ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.02 sec)
可以看到修改引數以及加上row_format=dynamic後表建立成功了。
相關文章
- Index column size too large. The maximum column size is 767 bytesIndex
- Index column size too large. The maximum column size is 767 bytes.Index
- mysql5.7 資料匯入5.6 Index column size too large. The maximum column size is 767 bytes.MySqlIndex
- 1709 - Index column size too large. The maximum column size is 767 bytes.Index
- MySQL建立表失敗:Index column size too large. The maximum column size is 767 bytesMySqlIndex
- mysql specified key was too long與Index column size too large. The maximum column size is 767 bytes.MySqlIndex
- [Err] 1709 - Index column size too large. The maximum column size is 767 bytes.Index
- MySQL資料庫index column size too large. the maximum column size is 767 bytes問題解決MySql資料庫Index
- mysql Index column size too large 超過767錯誤解決方案(轉)MySqlIndex
- #1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs
- MySQL:Specified key was too long; max key length is 767 bytesMySql
- 【Mysql】MySQL 5.7新特性之Generated Column(函式索引)MySql函式索引
- Mysql 報Row size too large 65535解決方法MySql
- ORA-28348, encryption column TDE, function indexFunctionIndex
- 解決 Specified key was too long ... 767 bytes 的本質問題
- 高效的SQL(index values與index column values關係?)SQLIndex
- 'mysql.column_stats' doesn't exist and Table 'mysql.index_stats' doesn't existMySqlIndex
- MySQL5.7更改密碼時出現ERROR 1054 (42S22): Unknown column 'password' in 'field list'MySql密碼Error
- Mysql Key Buffer SizeMySql
- GGS ERROR 160 Bad column indexErrorIndex
- LeetCode-Maximum Size Subarray Sum Equals kLeetCode
- ProTable 報錯Uncaught RangeError: Maximum call stack size exceededError
- zblog顯示Allowed memory size of 6553652 bytes exhauste
- Vue專案中出現:Maximum call stack size exceeded(堆疊溢位)Vue
- MySQL5.7忘記密碼時出現ERROR 1054 (42S22): Unknown column 'password' in 'field list'MySql密碼Error
- TABLE size (including table,index,lob,lobindex)Index
- Windows下Mysql5.6升級到5.7WindowsMySql
- js中Uncaught RangeError: Maximum call stack size exceeded錯誤JSError
- Allowed memory size of 134217728 bytes 錯誤解決心得
- Row size too large (> 8126)解決辦法
- Error: no such columnError
- java.lang.IndexOutOfBoundsException: Index: 0, Size: 0JavaIndexException
- MySQL5.7 線上調整Innodb_Buffer_Pool_size不用重啟mysql程式薦MySql
- Oracle 反向索引 where index_column like '%xxx'Oracle索引Index
- 【tomcat8】consider increasing the maximum size of the cacheTomcatIDE
- MySQL:5.6 升級 5.7MySql
- PHP Fatal error: Allowed memory size of 1610612736 bytesPHPError
- 啟動Amoeba報The stack size specified is too small解決方法