iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >mysql错误:Row size too large (> 8126).
  • 550
分享到

mysql错误:Row size too large (> 8126).

2024-04-02 19:04:59 550人浏览 八月长安
摘要

Mysql版本:mysql 5.6mysql引擎:默认InnoDB问题原因:由于一张定义角色信息表有接近300列,并且多数是blog的数据类型,数据存储时报这个错:Row size too large (&

Mysql版本:mysql 5.6
mysql引擎:默认InnoDB
问题原因:由于一张定义角色信息表有接近300列,并且多数是blog的数据类型,数据存储时报这个错:
Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help
问题分析:
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.
解决方法:
1、修改mysql配置文件my.cnf
innodb_file_per_table
innodb_file_format = Barracuda
2、修改造成这个问题的表属性
ALTER TABLE $TABLE
ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
3、重启mysql服务
4、通过写sql语句修改mysql环境配置,可以免重启服务。当然,配置文件中也必须配置上面两个参数,这个操作只是避免此次重启mysql服务
mysql> set global innodb_file_per_table =ON;
mysql> SET GLOBAL innodb_file_format = barracuda;

您可能感兴趣的文档:

--结束END--

本文标题: mysql错误:Row size too large (> 8126).

本文链接: https://www.lsjlt.com/news/35315.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作