Linux服务器上日志报com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1783 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
在做查询数据库操作时,报了以上错误,还有out of memery heap hacp ,原因是MySQL的max_allowed_packet设置过小引起的,我一开始设置的是1M,后来改为了20M
mysql根据配置文件会限制server接受的数据包大小。
有时候大的插入和更新会被max_allowed_packet 参数限制掉,导致失败。
查看目前配置
show VARIABLES like '%max_allowed_packet%';
显示的结果为:
+--------------------+---------+ | Variable_name
以上说明目前的配置是:1M
修改方法
1) 方法1
可以编辑my.cnf来修改(windows下my.ini),在[mysqld]段或者mysql的server配置段进行修改。
max_allowed_packet = 20M
如果找不到my.cnf可以通过
mysql --help | grep my.cnf
去寻找my.cnf文件。
2) 方法2
(很妥协,很纠结的办法)
进入mysql server
在mysql 命令行中运行
set global max_allowed_packet = 2*1024*1024*10
然后关闭掉这此mysql server链接,再进入。
show VARIABLES like '%max_allowed_packet%';
查看下max_allowed_packet是否编辑成功
经验总结:
在很多台机器上用方法一都没问题,但2011年11月14日遇到一台机器死活都不成功,
使用命令行方式:set global max_allowed_packet = 16M;
也不行,但使用
set global max_allowed_packet = 2*1024*1024*10;
成功了,很是郁闷
问题终于找出来了,不是方法的问题,是设置完成后要把命令行退出重新登录查看,看来系统变量的值在登录后会缓存。但在这台机器上使用配置INI文件。
Linux服务器上日志报com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1783 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.的更多相关文章
- Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (16944839 > 16777216). You can change this value on the server by setting the max_allowed_packet' variable.
今天发现task微服务的error日志报如下错误: Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large ...
- com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1680 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
这个错误是由于mysql的一个系统参数max_allowed_packet设置的值过小引起的 解决这个错误的方法就是修改这个参数的值, linux系统中我们在etc目录下找到my.cnf这个文件,打开 ...
- mysql Packet for query is too large (2036 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
解决方法: 打开控制台,输入下面语句,执行 set global max_allowed_packet = 20*1024*1024; 网上说要重启 mysql server, 我是执行完后不用重启就 ...
- 服务器的日志一直报Packet for query is too large (7632997 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.的解决方法
服务器的日志一直报Packet for query is too large (7632997 > 4194304). You can change this value on the serv ...
- MYSQL Packet for query is too large (12054240 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
MYSQL Packet for query is too large (12054240 > 4194304). You can change this value on the server ...
- com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1169 > 1024)
### Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1169 > 1024). You ...
- nested exception is com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1044 > 1024
HTTP Status 500 - type Exception report message description The server encountered an internal error ...
- Mysql报错:Packet for query is too large (1121604 > 1048576).You can change this value on the server by setting the max_allowed_packet variable
看错误信息,发现1048576个字节,正好是1*1024*1024byte,也就是1Mb. 这正是mysql默认的max_allowed_packet值. 使用sql语句: show VARIABLE ...
- 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 ...
随机推荐
- 使用mongoperf评估磁盘随机IO性能
用法举例: # 16个io线程 # 随机读写10GB的测试文件 echo "{nThreads:16,fileSizeMB:10000,r:true,w:true}" | mong ...
- TimeHelp 获取时间戳转换类
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Shar ...
- Ubuntu各种indicator汇总
1. indicator-multiload: 可视化图形显示 sudo apt-get install indicator-multiload 2. indicator-sysmonitor: 以 ...
- httpd编译安装
Apache安装问题:configure: error: APR not found . Please read the documentation: Linux上安装Apache时,编译出现错误: ...
- 把XML保存为ANSI编码
XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlText); //plu.xml 编码是ANSI的.否则称上品名是乱码 XmlEle ...
- CI 框架怎么去掉隐藏入口文件 index.php
当我重新接触一个框架的时候首先肯定要去掉入口文件,也就是index.php 这个东西在url上很不漂亮,而且每次我访问我的网站的时候都要打进去url里面.这样告诉一个去掉 CI框架里面入口文件的方法, ...
- vue打包优化
网站首页第一次加载很慢,优化过后从十多二十秒缩短到了几秒,主要是打包的时候按需加载了,然后使用了gzip压缩. 这是优化之前的 发现vendor特别大,所有引用的第三方库都会打到这个包里面;另外就是之 ...
- C#计数器
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 熟练使用Linux系统信息类命令
系统信息类命令 – dmesg命令 dmesg命令用实例名和物理名称来标识连到系统上的设备. dmesg命令显示系统诊断信息.操作系统版本号.物理内存大小以及其他信息. 系统启动时,屏幕上会显示系统C ...
- Meet Solr
you should have a solid understanding of Solr's query and indexing capabilities, including how to pe ...