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. 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中,每一张数据表最多仅可以有4096个字段,但是实际的情形会因为一些因素而少于4096个字段,例如maximum row size constrains。

第二、InnoDB限制row size的大小,但是部分字段不再此限。

  • InnoDB restricts row size to something less than half a database page (approximately 8000 bytes), not includingVARBINARY, VARCHAR, BLOB, or TEXT columns.

当数据表的字段过多,衍生一个问题,各个字段的长度加总超出maximum row size constrains的限制时,将会出现下列错误:

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

倘若使用Code First连接MySQL,解决的方式在于Data Annotation:

public string Description { get; set; }

数据来源:

[1]D.7.4 Limits on Table Column Count and Row Size
https://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html

[2]How do I specify that a property should generate a TEXT column rather than an nvarchar(4000)
http://stackoverflow.com/questions/4895465/how-do-i-specify-that-a-property-should-generate-a-text-column-rather-than-an-nv