当前位置:网站首页>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
边栏推荐
- Binary tree -- using hierarchical sequence and middle sequence to determine a tree
- Arduino uses esp8266+ lighting technology + Xiaoai audio to realize voice control switch
- 磁盘分区方式对比(MBR与GPT)
- Canvas game 2048 free map size
- 408 true question - division sequence
- 什么是 dummy change?
- Influence of higher order poles on waveform
- Canvas random bubbling background
- People and gods are angry. Details of Tangshan "mass beating of women incident"
- Hard (magnetic) disk (I)
猜你喜欢

Mysql批量插入数据时如何解决重复问题?

Kotlin coroutine suspend function suspend keyword

Assembly language learning
![[imx6ull] video monitoring project (USB camera +ffmepeg)](/img/f9/1a7b68083b52c973336db9044b52c2.jpg)
[imx6ull] video monitoring project (USB camera +ffmepeg)

Canvas random bubbling background

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

sort

How many rounds of deep learning training? How many iterations?

Win10 home vs pro vs enterprise vs enterprise LTSC

Binary tree - right view
随机推荐
MySQL locates the position of the character in the string String substitution
Deep learning model pruning
MySQL query table field information
Static analysis of malicious code
pytorch和tensorflow有什么区别?
天津银行周传凯:从 0 到 1,我的分布式数据库落地经验谈
[JS component] customize the right-click menu
.net core 抛异常对性能影响的求证之路
Canvas game lower level 100
[virtual machine] notes on virtual machine environment problems
Maybe we can figure out the essence of the Internet after the dust falls
Illustrator tutorial, how to add dashes and arrows in illustrator?
Three column simple Typecho theme lanstar/ Blue Star Typecho theme
Arduino controls tb6600 driver +42 stepper motor
蓝桥杯单片机第七届决赛
kotlin 协程withContext切换线程
(01). Net Maui actual construction project
antdPro - ProTable 实现两个选择框联动效果
People and gods are angry. Details of Tangshan "mass beating of women incident"
Learning and Development notes of mongdb