6

mysql 语句的长度限制

 1 year ago
source link: https://abcdxyzk.github.io/blog/2023/05/07/mysql-allowed/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

mysql 语句的长度限制

2023-05-07 16:17:00

https://blog.csdn.net/yuchenai/article/details/111470453

一、max_allowed_packet是什么?

指mysql服务器端和客户端在一次传送数据包的过程当中最大允许的数据包大小。

具体的数值可以根据sql语句来查看:

show VARIABLES WHERE Variable_name LIKE 'max_allowed_packet';

二、什么情况下遇到?

有时候大的插入和更新会被max_allowed_packet 参数限制掉,导致失败。

场景一:将本地数据库迁移到远程数据库时运行sql错误。错误信息是max_allowed_packet

场景二:插入数据时某个字段数据过于庞大(使用Elmentui编辑器自带的图片加密,图片过多,地址超级长,最好用的时候改成自定义的),会报

Packet for query is too large (20682943>1048576). You can change this value on the server by setting the max_allowed_packet’ variable.

三、解决办法

修改 /etc/my.cnf 在mysqld段下添加

max_allowed_packet 64M

注意改完参数后需要重启mysql服务

Posted by kk

2023-05-07 16:17:00tools, mysql

« PHP中 result_array()和row_array()的区别 索引合并 和 组合索引、复合索引、联合索引 »

wx_ok.pngali_ok.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK