当前位置:网站首页>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
边栏推荐
- @Disallowcurrentexecution prevents quartz scheduled tasks from executing in parallel
- [JS component] create a custom horizontal and vertical scroll bar following the steam style
- 生物解锁--指纹录入流程
- 为什么磁盘分区的时候,第一个分区前面总有一段空间(63或者2048个扇区)
- 磁盘分区方式对比(MBR与GPT)
- gpu加速pytorch能用吗?
- 【SCA-CNN 解读】空间与通道注意力:Spatial and Channel-wise Attention
- What is meebits? A brief explanation
- Summary of openstack installation problems
- 蓝桥杯单片机第七届决赛
猜你喜欢
Cards are unpredictable
Maybe we can figure out the essence of the Internet after the dust falls
Canvas random bubbling background
[buglist] serial port programming does not read data
[JS component] floating text
[JS] battle chess
Download nail live playback through packet capturing
Arduino control tm1637 common positive four digit nixie tube
[error] invalid use of incomplete type uses an undefined type
DNS attack surface analysis
随机推荐
【服务器数据恢复】存储服务器之间迁移数据时数据丢失恢复成功案例
MySQL lpad() and rpad() concatenate string functions with specified length
Illustrator tutorial, how to add dashes and arrows in illustrator?
408 true question - division sequence
What are the conditions of index invalidation?
Arduino controls tb6600 driver +42 stepper motor
Four startup modes of kotlin collaboration
@Disallowcurrentexecution prevents quartz scheduled tasks from executing in parallel
ROS从入门到精通(零) 教程导读
Canvas random bubbling background
Can GPU acceleration pytorch work?
Card constructions -- two points
Deep learning model pruning
ImportError: cannot import name 'get_ora_doc' from partially initialized module
[JS] solve the problem that removeeventlistener is invalid after the class listening event from new is bound to this
Physical orbit simulation
Arduino control soil moisture sensor
人神共愤,唐山“群殴女性事件”细节...
[GYCTF2020]Ezsqli --BUUCTF
MySQL query table field information