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)