zoukankan      html  css  js  c++  java
  • MySQL插入单行数据较大时报Row size too large错误 解决方案

    mysql 版本 5.5

    向目的MySQL写入数据时,单行数据较大,遇到插入失败,报错信息如下:
    Error '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.' on query. ......

    解决:

    1. 先查看

    show GLOBAL VARIABLES LIKE '%file_format%';  
    +--------------------------+----------+
    | Variable_name            | Value    |
    +--------------------------+----------+
    | innodb_file_format       | Antelope |
    | innodb_file_format_check | ON       |
    | innodb_file_format_max   | Antelope |
    +--------------------------+----------+

    mysql> show variables like '%per_table%';
    +-----------------------+-------+
    | Variable_name         | Value |
    +-----------------------+-------+
    | innodb_file_per_table | OFF   |
    +-----------------------+-------+
    1 row in set (0.03 sec)


    2. 修改参数: my.cf中在[mysqld] 加入

    innodb_file_format = Barracuda
    innodb_file_per_table = 1 

        检查修改后的结果:

    mysql> show variables like '%per_table%';
    +-----------------------+-------+
    | Variable_name         | Value |
    +-----------------------+-------+
    | innodb_file_per_table | ON    |
    +-----------------------+-------+
    1 row in set (0.00 sec)
    
    
    mysql> show GLOBAL VARIABLES LIKE '%file_format%';
    +--------------------------+-----------+
    | Variable_name            | Value     |
    +--------------------------+-----------+
    | innodb_file_format       | Barracuda |
    | innodb_file_format_check | ON        |
    | innodb_file_format_max   | Barracuda |
    +--------------------------+-----------+
    3 rows in set (0.00 sec)

    3. 修改表

    Alter table <table_name> engine=innodb ROW_FORMAT=DYNAMIC;


  • 相关阅读:
    Java反射获取对象VO的属性值(通过Getter方法)
    HTML的级联Select
    ORACLE 新增记录 & 更新记录
    ORACLE 仿照原表建表语法
    ActiveMQ反序列化漏洞(CVE-2015-5254)复现
    滥用DNSAdmins权限进行Active Directory提权
    Weblogic CVE-2018-3191远程代码命令执行漏洞复现
    Libssh认证绕过CVE-2018-10933漏洞复现
    Linux kernel(CVE-2018-17182)提权漏洞复现
    时间延迟盲注详解
  • 原文地址:https://www.cnblogs.com/youjianjiangnan/p/12859897.html
Copyright © 2011-2022 走看看