mysql innodb 表行大小限制(Row Size Limit)ERROR 1118 (42000): Row size too large (> 8126).

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/royjj/article/details/85328306

mysql innodb 表行大小限制(Row Size Limit)
遵循2个规则,这个两个规则必须同时遵守,但对于innodb 引擎表而言单表行大小不能大于: 1/2(innodb_page_size
#1:maximum row size limit of 65,535 bytes

#2:InnoDB restricts row size (for data stored locally within the database page) to slightly less than half
a database page for 4KB, 8KB, 16KB, and 32KB innodb_page_size settings

####报错规则
如果表的行大小超过65535. 直接报错:ERROR 1118 (42000): Row size too large.
如果表的行大小超过8126 但是小于65535 报错信息为:ERROR 1118 (42000): Row size too large (> 8126)


mysql>CREATE TABLE t4 (
    -> c1 CHAR(255),c2 CHAR(255),c3 CHAR(255),
    -> c4 CHAR(255),c5 CHAR(255),c6 CHAR(255),
    -> c7 CHAR(255),c8 CHAR(255),c9 CHAR(255),
    -> c10 CHAR(255),c11 CHAR(255),c12 CHAR(255),
    -> c13 CHAR(255),c14 CHAR(255),c15 CHAR(255),
    -> c16 CHAR(255),c17 CHAR(255),c18 CHAR(255),
    -> c19 CHAR(255),c20 CHAR(255),c21 CHAR(255),
    -> c22 CHAR(255),c23 CHAR(255),c24 CHAR(255),
    -> c25 CHAR(255),c26 CHAR(255),c27 CHAR(255),
    -> c28 CHAR(255),c29 CHAR(255),c30 CHAR(255),
    -> c31 CHAR(255),c32 CHAR(255),c33 CHAR(255),c34 blob,c35 varchar(27120)
    -> ) ENGINE=InnoDB ROW_FORMAT=COMPACT DEFAULT CHARSET latin1;
ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

mysq>  CREATE TABLE t4 (
    -> c1 CHAR(255),c2 CHAR(255),c3 CHAR(255),
    -> c4 CHAR(255),c5 CHAR(255),c6 CHAR(255),
    -> c7 CHAR(255),c8 CHAR(255),c9 CHAR(255),
    -> c10 CHAR(255),c11 CHAR(255),c12 CHAR(255),
    -> c13 CHAR(255),c14 CHAR(255),c15 CHAR(255),
    -> c16 CHAR(255),c17 CHAR(255),c18 CHAR(255),
    -> c19 CHAR(255),c20 CHAR(255),c21 CHAR(255),
    -> c22 CHAR(255),c23 CHAR(255),c24 CHAR(255),
    -> c25 CHAR(255),c26 CHAR(255),c27 CHAR(255),
    -> c28 CHAR(255),c29 CHAR(255),c30 CHAR(255),
    -> c31 CHAR(255),c32 CHAR(255),c33 CHAR(255),c34 blob,c35 varchar(65535)
    -> ) ENGINE=InnoDB ROW_FORMAT=COMPACT DEFAULT CHARSET latin1;
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. You have to change some columns to TEXT or BLOBs

MySQL建表报错!Row size too large

10-10

Hibernate在MySQL自动建表时报了以下错误~ rnrnERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: create table Advert (id bigint not null auto_increment, space varchar(255), administrators varchar(4000), readers varchar(4000), editors varchar(4000), creator varchar(255), salesman varchar(255), spaceSize varchar(255), advertType varchar(255), createDate varchar(255), contactName varchar(255), receivableDate varchar(255), money varchar(255), publishTime varchar(255), advertName varchar(255), salesmanId varchar(255), newsSerialNumber varchar(255), advertDate varchar(255), draftDate varchar(255), spaceEdit varchar(255), newsAdd varchar(255), drafter varchar(255), advertContent varchar(1300), remack varchar(4000), contract_id bigint, customer_id bigint, primary key (id)) rnrnERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - 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 BLOBs rnrn自己算了一下,这张表怎么都还没到65535啊~ rnrn后来上网找了一下,发现UTF-8编码的,一个字符当3个算~郁闷~ rnrn然后自己算了一下,确实超过了,然后减少了其中一个varchar,表就建起来了~ rnrn再后来上官网看到好像是InnoDB限制了,但它又没说怎么去改(最主要是我不知道InnoDB是什么……)! rnrn所以想请教一下大家,是否有办法改一下什么配置能让它把表建起来~谢谢~ rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试