当前位置:网站首页>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
边栏推荐
- Leetcode weekly -- April to May
- Buuctf's babysql[geek challenge 2019]
- What are the conditions of index invalidation?
- Hard (magnetic) disk (I)
- Buuctf babyupload[gxyctf2019]
- Kali system -- dnsrecon for DNS collection and analysis
- 今日在家休息
- [North Asia server data recovery] data recovery case of Hyper-V service paralysis caused by virtual machine file loss
- Bubble sort - alternate sort at both ends
- Card constructions -- two points
猜你喜欢

Arduino control soil moisture sensor

Kotlin 协程挂起函数 suspend 关键字

Win10 home vs pro vs enterprise vs enterprise LTSC

What is the difference between pytorch and tensorflow?

Learning and Development notes of mongdb

Target recognition gadget
![Buuctf babyupload[gxyctf2019]](/img/e8/202298b64d8764355fad348b50fee6.png)
Buuctf babyupload[gxyctf2019]

408 true question - division sequence

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

Canvas random bubbling background
随机推荐
Kotlin coroutine withcontext switch thread
Arduino interrupt
kotlin 协程withContext切换线程
408 true question - division sequence
[network protocol] problems and solutions in the use of LwIP
Arduino control soil moisture sensor
MySQL query table field information
3623. Merge two ordered arrays
牌好不好无法预料
Browser console injection JS
Tree - delete all leaf nodes
Canvas airplane game
[North Asia server data recovery] data recovery case of Hyper-V service paralysis caused by virtual machine file loss
Learning and Development notes of mongdb
Kali system -- dnsmap for DNS collection and analysis
[error] invalid use of incomplete type uses an undefined type
人神共愤,唐山“群殴女性事件”细节...
Androi天氣
In / out / inout details of MySQL stored procedures
Buuctf babyupload[gxyctf2019]