• 【BUG】插入或者更新超过限制后写入数据库失败


     
    Error Code: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Usage: mysqldump [OPTIONS] database [tables]   OR mysqldump [OPTIONS] --databa' at line 1
    报错: Error Code: 2006 - MySQL server has gone away
     
    mysql根据配置文件会限制server接受的数据包大小。
    有时候大的插入和更新会受max_allowed_packet 参数限制,导致写入或者更新失败。
     

    查看目前配置

    SHOW VARIABLES LIKE '%max_allowed_packet%';
     
    解决方法
    SET GLOBAL  max_allowed_packet=67108864;
    SET GLOBAL  net_buffer_length=10000;   
     
    注意:该值设置过小将导致单个记录超过限制后写入数据库失败,且后续记录写入也将失败 
  • 相关阅读:
    修改python默认版本
    Ansible基础
    day21
    paramiko上传文件到Linux
    参考书籍
    C++解析三
    块设备
    assert用法
    块设备驱动2
    块设备驱动1
  • 原文地址:https://www.cnblogs.com/zhutouying/p/6134724.html
Copyright © 2020-2023  润新知