问题:
PHP运行时出现Error while sending QUERY packet的错误
原因:
- 在mysql中运行 show VARIABLES LIKE 'max_allowed_packet';
- 查看max_allowed_packet值大小,如果max_allowed_packet值太低的话,会报出标题的错误
解决:
-
编辑my.cnf(windows下my.ini),在[mysqld]段或者mysql的server配置段进行修改max_allowed_packet = 50M (或max_allowed_packet = 50 * 1024 * 1024)
-
命令行修改set global max_allowed_packet = 50 * 1024 * 1024