当前位置:网站首页>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
边栏推荐
- pytorch是什么?解释pytorch的基本概念
- (01).NET MAUI实战 建项目
- Win10 home vs pro vs enterprise vs enterprise LTSC
- Arduino control soil moisture sensor
- MySQL queries the quantity of each month and the year-on-year and month on month data of each month
- Sequence table - find main element
- [JS component] dazzle radio box and multi box
- Three threads print digital demo alternately
- Card constructions -- two points
- Physical orbit simulation
猜你喜欢

Mysql database password modification

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

Kotlin 协程挂起函数 suspend 关键字

Static analysis of malicious code

In / out / inout details of MySQL stored procedures

Kalix system - use of information collection gadgets

市值破万亿,连续三个月销量破10万,比亚迪会成为最强国产品牌?

牌好不好无法预料

Win10 home vs pro vs enterprise vs enterprise LTSC
![[ciscn2019 North China Day2 web1]hack world --buuctf](/img/1e/ebf8cc06ba620261f03f84ca2c68e6.png)
[ciscn2019 North China Day2 web1]hack world --buuctf
随机推荐
Assembly language learning
Three threads print digital demo alternately
Blinker FAQs
生物解锁--指纹录入流程
Canvas game 2048 free map size
硬(磁)盘(二)
Win10 home vs pro vs enterprise vs enterprise LTSC
MySQL lpad() and rpad() concatenate string functions with specified length
OceanBase 雄踞墨天轮2021年度中国数据库魔力象限领导者
Arduino uses esp8266+ lighting technology + Xiaoai audio to realize voice control switch
Opencv face recognition of ros2 foxy~galactic~humble
也许尘埃落地,我们才能想清楚互联网的本质
The seventh finals of the Blue Bridge Cup
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?
Illustrator tutorial, how to add dashes and arrows in illustrator?
草在结种子了
Download nail live playback through packet capturing
Notes: the 11th and 12th generation mobile versions of Intel support the native thunderbolt4 interface, but the desktop version does not
Mysql database password modification
AOF持久化