当前位置: 代码迷 >> 综合 >> 解决Mysql 'max_allowed_packet' variable 异常
  详细解决方案

解决Mysql 'max_allowed_packet' variable 异常

热度:3   发布时间:2023-12-22 01:56:55.0

在SQL操作的时候报错如下

Mysql You can change this value on the server by setting the max_allowed_packet' variable. 
Packet for query is too large (7012 > 2048). You can change this value on the server by setting the max_allowed_packet' variable.

解决方案
修改mySql的配置文件
1、查看现有的配置

mysql> show VARIABLES like '%max_allowed_packet%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| max_allowed_packet       | 2048  |
| slave_max_allowed_packet | 2048  |
+--------------------------+-------+
2 rows in set (0.03 sec)

2、修改配置my.cnf

[root@VM_16_16_centos ~]# vi /etc/my.cnf

3、重启mysql

service mysqld restart

完!

  相关解决方案