前段时间,看MySQL的行格式的时候,发现MySQL的单行限制以及超过限制时自动类型转换。
1. MySQL版本:5.7.26
2. 关闭严格模式,否则直接报错。
3. utf8编码
-- 第一种情况
CREATE TABLE ts_test (
id int(11) unsigned NOT NULL auto_increment,
a varchar(10000) DEFAULT NULL,
b varchar(10000) DEFAULT NULL,
n varchar(10000) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
[Err] 1118 - 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
-- 第二种情况
CREATE TABLE ts_test (
id int(11) unsigned NOT NULL auto_increment,
a varchar(30000) DEFAULT NULL,
b varchar(30000) DEFAULT NULL,
c varchar(30000) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=INNODB DEFAULT CHARSET&#