修改mysql max_allowed_packet 配置

Posted yshyee

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了修改mysql max_allowed_packet 配置相关的知识,希望对你有一定的参考价值。

1:当前默认配置

mysql> show VARIABLES like ‘%max_allowed_packet%‘;
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| max_allowed_packet | 4194304 |
| slave_max_allowed_packet | 1073741824 |
+--------------------------+------------+
2 rows in set (0.00 sec)

 

2:修改配置文件

vi /etc/my.cnf

 

[mysqld] 下面增加下面配置:

max_allowed_packet=10M

 

3:重启mysql

service mysqld restart

再次查看修改后的配置

mysql> show VARIABLES like ‘%max_allowed_packet%‘;
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| max_allowed_packet | 10485760 |
| slave_max_allowed_packet | 1073741824 |
+--------------------------+------------+
2 rows in set (0.00 sec)

 

以上是关于修改mysql max_allowed_packet 配置的主要内容,如果未能解决你的问题,请参考以下文章

mysql has gone away

MySQL server has gone away 问题的解决方法

MySQL server has gone away 问题的解决方法

MySQL server has gone away 问题的解决方法

delphi连接mysql出现MySql server has gone away怎么解决

mysql配置文件详解