mysql Row size too large (> 8126) 错误的解决方案
今天用mysql innoDB建了个有256字段的大表。。。。
别问为什么,老业务就是这样的。。
然后就陆陆续续报了各种魔幻性错误:
1.正常给各种字段赋予 varchar int 等类型时,它会报错
DN varchar(32) null KC varchar(32) null PAT varchar(32) null AN varchar(32) null ANS varchar(32) null ADY varchar(32) null AD varchar(32) null PR varchar(32) null EPRD varchar(32) null PN varchar(32) null PDY varchar(32) null PD varchar(32) null BN varchar(32) null ZLH varchar(32) null DAN varchar(32) null TI varchar(32) null SIC varchar(32) null SICN varchar(32) null .....还有很多字段
Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. Got error 139 - Too big row from storage engine
2.然后根据提示,一股脑改成text
DN text null KC text null PAT text null AN text null ANS text null ADY text null AD text null PR text null EPRD text null PN text null PDY text null PD text null BN text null ZLH text null DAN text null TI text null SIC text null
仍然报错。。。
Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. Got error 139 - Too big row from storage engine
解决方法,表的引擎换成MyISAM即可
-- auto-generated definition create table p_patent_txt ( id varchar(32) not null primary key , DN text null comment 文献号 , KC text null comment 公开类型 , PAT text null comment 专利类型 , AN text null comment 申请号 , ANS text null comment 申请号统计 )engine=MyISAM;
注意:
MySQL5.5版本开始Innodb已经成为Mysql的默认引擎(之前是MyISAM),说明其优势是有目共睹的,如果你不知道用什么,那就用InnoDB,至少不会差。