mysql5.7 [Err] 1118 – Row size too large (> 8126).

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

mysql [Err] 1118 – Row size too large (> 8126).

Questions

When mysql5.7 creates a table or adds fields, it is found that the row size is too long, resulting in the following error

[Err] 1118 - 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.

Solutions

Row size is the total length of all fields solve the problem without splitting the table (we don’t discuss whether the design is reasonable) : knowledge post: https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html

You may want to take a look at this article which explains a lot about MySQL row sizes. It's important to note that even if you use TEXT or BLOB fields, your row size could still be over 8K (limit for InnoDB) because it stores the first 768 bytes for each field inline in the page.

The simplest way to fix this is to use the Barracuda file format with InnoDB. This basically gets rid of the problem altogether by only storing the 20 byte pointer to the text data instead of storing the first 768 bytes.

Method 1: change some fields varchar to text or blob. Invalid, can’t solve the problem

final solution

https://stackoverflow.com/questions/22637733/mysql-error-code-1118-row-size-too-large-8126-changing-some-columns-to-te

Query system parameters:

show variables like '%innodb_strict_mode%';  

show variables like '%innodb_log_file_size%';

Before revision:

innodb_strict_mode	ON
innodb_log_file_size	536870912

Modify the configuration file of MySQL, VI/etc/my.cnf

innodb_log_file_size=1024M
innodb_strict_mode=0

innodb_ strict_ Mode = 0 must not be omitted, otherwise it will not take effect. After restart:

innodb_strict_mode	OFF
innodb_log_file_size	1073741824

it work 。 Stuck for a long time, and finally solved by this solution

Similar Posts: