關於mysql varchar 型別的最大長度限制

洋蔥土豆隨心匠發表於2016-04-01

 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

 

今天修改欄位型別(打算增加某個欄位varchar的長度)時遇到這麼一個錯誤。

癥結在於這個表的欄位比較多,varchar型別的所有長度超過了限制。資料庫採用utf-8編碼,varchar(N)中N的總和不能大於 (65535-1-2-4-30*3)/3=21812 這個值。粗略估計已經超了。

解決方法是將需要擴大的這個欄位改成text型別。

相關文章