zoukankan      html  css  js  c++  java
  • MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large

    ### Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1169 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.; SQL []; Packet for query is too large (1169 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.; nested exception is com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1169 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.

    原因是MySQL的max_allowed_packet设置过小引起的,我一开始设置的是1M,后来改为了20M

    mysql根据配置文件会限制server接受的数据包大小。有时候大的插入和更新会被max_allowed_packet 参数限制掉,导致失败。 

    在mysql命令行中执行命令

    1、查看当前配置

      show VARIABLES like '%max_allowed_packet%';

      

    2、修改配置

      set global max_allowed_packet = 2*1024*1024*10;
    把max_allowed_packet的值修改的大点、修改完成后mysql重新启动服务,但是项目可能也要重新启动。

    3、Linux系统下

      在linux下,进入到mysql安装目录下:

      进入到:

        /usr/local/mysql,找到my.cnf,增加一行

        max_allowed_packet = 20M

      重启mysql:

        service mysql restart

    参考文章:https://blog.csdn.net/qq_26824159/article/details/71514506?locationNum=11&fps=1

         https://www.cnblogs.com/gmq-sh/p/7096687.html

    我驰骋天下,守你盛世繁华
  • 相关阅读:
    深入js——this
    深入js——作用域链
    深入js——变量对象
    深入js——执行上下文栈
    vue为什么不能检测数组的变化
    常用的文件下载方式
    vue中修改第三方组件的样式不生效
    Neo4j 学习笔记2
    Neo4j 学习笔记1
    idea git 命令
  • 原文地址:https://www.cnblogs.com/lotuses/p/9999501.html
Copyright © 2011-2022 走看看