【问题描述】

1.从myslq(5.7.19-0ubuntu0.16.04.1)中导出sql脚本,导入到mysql(5.5.27)中,报如下错误:Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
2.程序向mysql(5.5.27)中存入数据报错如下:Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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.

【导致问题的原因】

原因是因为mysql-innodb是按照page存储数据的,每个page max size是16K,然后每个page两行数据,所以每行最大8K数据。如果你的字段是blob之类的话,会存储在page之外的溢出区里。
但是innodb默认的approach(羚羊)存储格式会把每个blob字段的前864个字节存储在page里,所以你的blob超过一定数量的话,单行大小就会超过8k,所以就报错了。

【解决思路】

解决方式是使用innodb的Barracuda(梭鱼)存储格式。这种格式对blob字段的处理方式是在page里面只存储一个20byte大小的指针,其他完全存在溢出区,所以轻易不会超过8K.

【详细步骤】

1.打开mysql的配置my.ini.在innodb配置中添加:innodb_file_per_table=1,(大概意思就是打开mysql每张表都是独立存储空间的开关)如下图:
 
2.然后命令检查上述开关是否打开:
SHOW VARIABLES LIKE '%per_table%'
如图就是打开的了。如果value值显示OFF,只需重启mysql服务即可。
3.设置mysql全局变量:innodb_file_format = Barracuda(梭鱼)
命令:set GLOBAL innodb_file_format = 'Barracuda';
然后检查下是否设置好了:
命令:show GLOBAL VARIABLES LIKE '%file_format%';
4.设置对应表的属性:ROW_FORMAT=DYNAMIC
ALTER TABLE zgzw_jibing_table ROW_FORMAT=DYNAMIC
按照如上步骤操作就OK了。

【声明】

本文参考了:http://blog.sina.com.cn/s/blog_8e9cceee0101k65j.html

Mysql_大字段问题Row size too large.....not counting BLOBs, is 8126.的更多相关文章

  1. mysql 报Row size too large 65535 原因与解决方法

    报错信息:Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535 ...

  2. mysql触发器应用和创建表错误代码: 1118 Row size too large. 解决

    1.针对数据库查询问题的方便,可以建立重要表的log备份记录表,在主表的添加,修改,删除添加触发器,修改触发器增加触发字段的点,限制条件. 数据库log表查问题比从线上多台服务器上下载日志文件相对方便 ...

  3. 【bug】 1118 Row size too large

    1118 Row size too large Every table (regardless of storage engine) has a maximum row size of 65,535 ...

  4. Mysql [Err] 1118 - Row size too large

    首先声明,对MySQL不懂,很多都不知道原因 设计了一个表,里面很多text字段,然后填进去的东西太多(用的是Python的MySQLdb),报错: _mysql_exceptions.Operati ...

  5. MySQLSyntaxErrorException: Row size too large 转摘自:https://confluence.atlassian.com/display/CONFKB/MySQLSyntaxErrorException%3A+Row+size+too+large

    Symptoms The following appears in the atlassian-confluence.log: Caused by: com.mysql.jdbc.exceptions ...

  6. Mysql [Err] 1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.

    对于越来越多的数据,数据库的容量越来越大,压缩也就越来越常见了.在我的实际工作中进行过多次压缩工作,也遇到多次问题,在此和大家分享一下. 首先,我们先说说怎么使用innodb的压缩. 第一,mysql ...

  7. [ERR] 1118 - Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.

    昨天,在测试新的数据库时,迁移表遇到了这个问题.现在记录一下解决方案. 1.在配置文件中添加关闭严格模式的配置:sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS ...

  8. 0809MySQL实战系列:大字段如何优化|数据存储结构

    转自https://yq.aliyun.com/articles/59256?spm=5176.100239.blogcont59257.9.5MLR2d 摘要: 背景 线上发现一张表,1亿的数据量, ...

  9. Limits on Table Column Count and Row Size Databases and Tables Table Size 最大行数

    MySQL :: MySQL 8.0 Reference Manual :: C.10.4 Limits on Table Column Count and Row Size https://dev. ...

随机推荐

  1. 【LeetCode每天一题】Add Binary(二进制加法)

    Given two binary strings, return their sum (also a binary string).The input strings are both non-emp ...

  2. pwn学习日记Day3 基础知识积累

    知识杂项 msfVENOM:Msfvenom是msf框架配套的攻击载荷生成器. payload:有效载荷. payload:目标系统上渗透成功后执行的代码. Metasploit:一款开源的安全漏洞检 ...

  3. Android通过Chrome Inspect调试WebView出现404页面的解决方法

    无论是调试Web页面还是调试Hybrid混合应用,只要是调试Android的webview,都需要使用Chrome://inspect进行调试.但是国内开发者会出现404 Not Found错误: 解 ...

  4. Qt QLineEdit 漂亮的搜索框 && 密码模式 && 格式化输入 && 提示文字 && 选择内容并移动 && 清除全部输入

    先上一个漂亮的搜索框效果图, 输入搜索文本效果, 点击搜索图标效果: //实现代码 void MainWindow::iniLineEdit() { ui->lineEdit->setPl ...

  5. php中双$符 及一些基础知识

    双$$符号表示可变变量 如 $a = "b", $b = 'c'; echo $$a    此时 $$a=>$($a) =>$b 输出的值就应该为c; 变量传应用值$b ...

  6. vs2017 .net core 项目调试浏览器网页闪退Bug

    from:https://blog.csdn.net/qq_36330228/article/details/82152187 vs更新2017最新版本后,项目调试浏览器莫名其妙出现闪退,每次都TMD ...

  7. Java利用原始HttpURLConnection发送http请求数据小结

    1,在post请求下,写输出应该在读取之后,否则会抛出异常. 即操作OutputStream对象应该在InputStreamReader之前. 2.conn.getResponseCode()获取返回 ...

  8. ubuntu装好jupyter启动失败问题

    ::/jupyter/nbserver-.json: [Errno ] Permission denied: '/run/user/1000/jupyter/nbserver-35390.json' ...

  9. React(上)

    一.React基础 1.React模板 凡是使用JSX的地方,要加上type="text/babel".引用三个库react.js是React的核心库,react-dom.js提供 ...

  10. ldd ldconfig

    ldd - print shared object dependencies ldconfig 主要是在默认搜寻目录/lib和/usr/lib以及动态库配置文件/etc/ld.so.conf内所列的目 ...