Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql error: Row size too large (& gt; 8126).

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Mysql version: mysql 5.6

Mysql engine: default InnoDB

The reason for the problem: due to the fact that a defined role information table has nearly 300 columns, and most of them are blog data types, the data storage times is wrong:

Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help

Problem analysis:

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.

Solution:

1. Modify mysql configuration file my.cnf

Innodb_file_per_table

Innodb_file_format = Barracuda

2. Modify the table properties that caused the problem

ALTER TABLE $TABLE

ENGINE=InnoDB

ROW_FORMAT=COMPRESSED

KEY_BLOCK_SIZE=8

3. Restart the mysql service

4. By writing sql statements to modify the mysql environment configuration, you can avoid restarting the service. Of course, the above two parameters must also be configured in the configuration file, which is just to avoid this restart of the mysql service.

Mysql > set global innodb_file_per_table = ON

Mysql > SET GLOBAL innodb_file_format = barracuda

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report