Home >Database >Mysql Tutorial >Why Does MySQL Throw a Row Size Too Large Error (1118) and How Can I Fix It?
MySQL Row Size Too Large Error (Code 1118): A Comprehensive Explanation
When attempting to create a table with a significant number of columns, such as the example provided with 325 columns, MySQL may throw an error indicating that the row size exceeds the maximum limit. This error is common when working with large tables and can be quite frustrating.
One of the troubleshooting steps mentioned in the question includes changing VARCHAR columns to TEXT or BLOB. TEXT and BLOB data types are used to store large amounts of data, such as text or binary data, and can accommodate more data compared to VARCHAR. Additionally, the introduction of the Barracuda file format in MySQL aims to improve performance and scalability, particularly for large tables.
However, even after implementing these measures, the question states that the error persists. To resolve this issue, another solution is to modify the MySQL configuration parameter innodb_strict_mode.
Setting innodb_strict_mode to 0:
As per the MySQL documentation, setting innodb_strict_mode to 0 disables certain checks and allows for more lenient handling of data validation. This can resolve the error related to row size exceeding the limit.
How to Modify innodb_strict_mode:
innodb_strict_mode = 0
Once innodb_strict_mode is set to 0, the row size limit enforcement is relaxed, allowing the table to be created without the previous error.
It is important to note that disabling strict mode may have implications for data integrity and accuracy. As a result, it is recommended to use this solution carefully and consider the impact on the database's functionality.
The above is the detailed content of Why Does MySQL Throw a Row Size Too Large Error (1118) and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!