当前位置:网站首页>MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
2022-06-13 00:49:00 【zly3500】
原因是MySQL的max_allowed_packet设置过小引起的,max_allowed_packet 如果不设置,默认值在不同的 MySQL 版本表现不同,有的版本默认1M,有的版本默认4M。
mysql根据配置文件会限制server接受的数据包大小。有时候大的插入和更新会被max_allowed_packet 参数限制掉,导致失败。
1、查看当前配置:
进入MYSQL![]()
命令: mysql -uroot -p
Enter password:mysql密码
(或是其它的数据库连接工具,查询或是命令行界面也可以)
查看当前配置:
输入show variables like '%max_allowed_packet%';
mysql> show variables like '%max_allowed_pack%';

2、1修改配置,我这里设置的是20M
在MYSQL里输入set global max_allowed_packet = 2*1024*1024*10;(20M)
mysql> set global max_allowed_packet = 10 * 1024 * 1024;
2、2(配置文件持久化修改):
vim /etc/my.cnf
[mysqld]
max_allowed_packet = 100M
注意:修改配置文件以后,需要重启mysql服务才能生效
1、使用 service 启动:service mysqld restart
2、使用 mysqld 脚本启动:/etc/inint.d/mysqld restart
启动:# service mysqld start
停止:# service mysqld stop
重启:# service mysqld restart
边栏推荐
- 三角波与三角波卷积
- Antdpro - protable realizes the linkage effect of two selection boxes
- MCU serial port interrupt and message receiving and sending processing -- judge and control the received information
- Canvas airplane game
- Deep learning model pruning
- Basic operations of FreeMarker
- 【服务器数据恢复】存储服务器之间迁移数据时数据丢失恢复成功案例
- In / out / inout details of MySQL stored procedures
- Illustrator tutorial, how to add dashes and arrows in illustrator?
- Aunt learning code sequel: ability to sling a large number of programmers
猜你喜欢

Druid reports an error connection holder is null

市值破万亿,连续三个月销量破10万,比亚迪会成为最强国产品牌?
![[ciscn2019 North China Day2 web1]hack world --buuctf](/img/1e/ebf8cc06ba620261f03f84ca2c68e6.png)
[ciscn2019 North China Day2 web1]hack world --buuctf

Summary of openstack installation problems

MySQL lpad() and rpad() concatenate string functions with specified length

Arduino control soil moisture sensor

人神共愤,唐山“群殴女性事件”细节...

Kalix system - use of information collection gadgets

【SCA-CNN 解读】空间与通道注意力:Spatial and Channel-wise Attention

ROS2之OpenCV人脸识别foxy~galactic~humble
随机推荐
What are the conditions of index invalidation?
Mongodb array operation
今日在家休息
408 true question - division sequence
antdPro - ProTable 实现两个选择框联动效果
Antdpro - protable realizes the linkage effect of two selection boxes
Three column simple Typecho theme lanstar/ Blue Star Typecho theme
Canvas game 2048 free map size
Kotlin 协程,job的生命周期
Stack overflow learning summary
Hard (magnetic) disk (II)
Triangle wave and triangle wave convolution
Another year 1024, happy programmer's Day!
Set sail
STM32 USB Basics
. The way to prove the effect of throwing exceptions on performance in. Net core
Kotlin coroutine withcontext switch thread
Aof persistence
How to determine whether T is a value type in a generic type or a reference class- How to determine whether T is a value type or reference class in generic?
Self use notes for problem brushing learning