MARIADB-发送QUERY数据包(不是max_allowed_packet)时出错 [英] MARIADB - Error while sending QUERY packet (not max_allowed_packet)
问题描述
我遇到了将数据保存到数据库(MariaDB)的PHP7脚本的问题.该脚本在以前的主机程序包上运行良好,但在我的新VPS上却无法正常运行.
I'm having an issue with a PHP7 script saving data to a database (MariaDB). The script worked fine on a previous hosting package, but not on my new VPS.
Warning: Error while sending QUERY packet. PID=1208 in ...
其他线程导致我查看设置,但是我的设置是:
Other threads caused me to look at settings, but my settings are:
- max_allowed_packet = 1GB
- wait_timeout = 10
我进一步审查了该问题,发现查询本身没有任何问题(它在 phpMyAdmin 中运行良好).
I've reviewed the issue further and found there is nothing wrong with the query itself (it executes fine in phpMyAdmin).
似乎与在不关闭连接的情况下连续执行两个查询有关(第二个查询失败).
同一脚本在旧主机上运行良好,这必须是一种设置-任何人有任何想法吗?
The same script ran fine on the old hosting, it must be a setting - does anyone have any ideas?
非常感谢,本
MariaDB配置(/etc/my.cnf):
MariaDB config (/etc/my.cnf):
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1GB
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
innodb_file_per_table
max_connections=70
max_user_connections=30
wait_timeout=10
interactive_timeout=50
long_query_time=5
推荐答案
问了1分钟后,我已经回答了我自己的问题.这就是问题所在:
1 minute after asking it, I've answered my own question. This was the issue:
wait_timeout=10
我以前的主机配置具有 = 180 ,这使我编写得不好的脚本可以正常工作.在 = 10 下,时间还不够长,无法完成任务.我现在已经将其加长到 180 ,但应该为此添加句柄.
My previous hosting configuration had =180 which make my poorly written script work. Under the =10 it's just not long enough for the task to complete. I have lengthened it to 180 now but should really add handle for this.
这篇关于MARIADB-发送QUERY数据包(不是max_allowed_packet)时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!