Tackling Error Code 1118: Row Size Exceeds Limit in MySQL
Encountering Error Code 1118 in MySQL indicates that the size of a row exceeds the permissible limit of 8126 bytes. This issue commonly arises when creating extensive tables with numerous columns.
To address this error, consider implementing the following solutions:
Optimize Column Types:
In your schema, you have declared some columns as CHAR(1), implying a character limit of only one character. Replacing these with TEXT or BLOB columns would significantly increase their capacity. Additionally, avoid using LONG columns.
Enable Barracuda File Format:
MySQL's Barracuda file format enhances performance and allows for larger row sizes. To activate it, add the following attributes to your MySQL configuration file (my.ini):
innodb_file_per_table=1 innodb_file_format=Barracuda innodb_file_format_check = ON
Adjust innodb_strict_mode:
If the previous measures yield no success, try modifying the innodb_strict_mode parameter to 0. This setting relaxes the row size check and allows for records to be inserted even if their size exceeds the specified limit:
innodb_strict_mode = 0
As you mentioned in your query, note that you cannot modify the table's structure due to legacy restrictions. Therefore, explore the above solutions and identify the most suitable approach for your specific application.
The above is the detailed content of How to Resolve MySQL Error Code 1118: Row Size Too Large?. For more information, please follow other related articles on the PHP Chinese website!