测试如下:、
mysql> CREATE TABLE t2 (a VARCHAR(65532)) TYPE=innodb;--最大只设65532
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> CREATE TABLE t3 (a VARCHAR(65533)) TYPE=innodb;---超过65532报错
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBsmysql> CREATE TABLE t17(a VARCHAR(65535)) TYPE=innodb;;---65535仍然报错
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBsmysql> CREATE TABLE t17(a VARCHAR(65536)) TYPE=innodb;---超过65535则之间建立mediumtext 类型
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> desc t17;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| a | mediumtext | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
1 row in set (0.00 sec)
- char类型
- 与官方文档一致最大只能255
- 超过定义的长度后,自动截断后面的字符
- innodb不会截断字符串前后的空格;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/190631/viewspace-628470/ ,如需转载,请注明出处,否则将追究法律责任。