当前位置:网站首页>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
- What is dummy change?
- Cve-2021-24078 vulnerability analysis
- Canvas airplane game
- 牌好不好无法预料
- [JS] battle chess
- MySQL lpad() and rpad() concatenate string functions with specified length
- Opencv face recognition of ros2 foxy~galactic~humble
- People and gods are angry. Details of Tangshan "mass beating of women incident"
- Three column simple Typecho theme lanstar/ Blue Star Typecho theme
猜你喜欢
[JS component] browse progress bar
Canvas game 2048 free map size
Illustrator tutorial, how to add dashes and arrows in illustrator?
MySQL lpad() and rpad() concatenate string functions with specified length
MySQL locates the position of the character in the string String substitution
How to solve the duplication problem when MySQL inserts data in batches?
In / out / inout details of MySQL stored procedures
Buuctf's babysql[geek challenge 2019]
Introduction to ROS from introduction to mastery (zero) tutorial
kotlin 协程withContext切换线程
随机推荐
MCU serial port interrupt and message receiving and sending processing -- judge and control the received information
Triangle wave and triangle wave convolution
[virtual machine] notes on virtual machine environment problems
Basic operations of FreeMarker
Hard (magnetic) disk (II)
Win10 home vs pro vs enterprise vs enterprise LTSC
Mysql database password modification
[JS component] calendar
pytorch和tensorflow有什么区别?
OceanBase 雄踞墨天轮2021年度中国数据库魔力象限领导者
蓝桥杯单片机第七届决赛
Kotlin 协程的作用域构建器 coroutineScope与runBlocking 与supervisorScope,协程同步运行,协程挂掉的时候其他协程如何不被挂掉。
[network protocol] problems and solutions in the use of LwIP
Kotlin 协程,job的生命周期
从ADK的WinPE自己手动构建自己的PE
Druid reports an error connection holder is null
Set sail
Androi weather
Assembly language learning
Kotlin 协程的四种启动模式