SoFunction
Updated on 2025-03-02

Solve the problem of SQL file importing MySQL database 1118 error

1. Problem description

Tip: The specific error is as follows

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

2. Cause analysis

Communicate with the colleague who sent the SQL file and said that it might be that the MySQL version he used was 5.7 and I used the 8.0 version. I did not verify the specific details later.

The reason for online search is roughly

"When you are creating a table or adding a field, you find that the row size is too long, which will cause the following error"

3. Solution

1. Execute the following SQL statement to check whether strict mode is enabled

// Check whether strict mode is enabled (the same is true when running in the Navicat new query here)show variables like '%innodb_strict_mode%';

2. If ON after execution, it needs to be closed

Variable_name			Value
innodb_strict_mode		ON

3. Find the MySQL configuration file location

My location is D:\Users\Work\Software\MySql\MySQL Data\, and you can view the system variables to find the installation directory.

Right-click to edit and add a new line under the [mysqld] configuration item

//Added under [mysqld]innodb_strict_mode=0

4. Save, and then restart MySQL service

// Execute the following SQL statement again to see if strict mode is closed

show variables like '%innodb_strict_mode%';
Variable_name			Value
innodb_strict_mode		OFF

If OFF, the execution is successful. Try importing again

I used this method to solve it, and the import is fine

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.