mysql Index column size too large 超過767錯誤解決方案(轉)


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM