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. Some columns to TEXT or BLOBs
[Email protected] 03:54: [test]> CREATE table t4 (c int, C2 char (+), C3 varchar (21813)) Charset=utf8;
ERROR 1118 (42000): 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. Some columns to TEXT or BLOBs
[Email protected] 03:55: [test]> CREATE table t4 (c int, C2 char (+), C3 varchar (21812)) Charset=utf8;
Query OK, 0 rows affected (0.04 sec)
If the character type is GBK, each character can be up to 2 bytes, and the maximum length cannot exceed 32766.
If the character type is UTF8, each character can be up to 3 bytes and the maximum length cannot exceed 21845.
The maximum value of n here is (65535-1-2-4-30*3)/3=21812
The reason for minus 1 is that the actual row storage starts with the second byte ';
The reason for minus 2 is that the 2 bytes of the varchar header represent the length;
The reason for minus 4 is that the int type C accounts for 4 bytes;
The reason for reducing 30*3 is that char (30) occupies 90 bytes and the encoding is UTF8.
MySQL's Vachar field type, although the maximum length is 65535, but is not able to save so much data, up to 65533 (do not allow non-empty fields when), when the non-empty field is allowed only to 65532.
This article from the "Clear Sky" blog, declined reprint!
MySQL Database row overrun