MARIADB - 发送 QUERY 数据包时出错(不是 max_allowed_pa​​cket) [英] MARIADB - Error while sending QUERY packet (not max_allowed_packet)

查看:29
本文介绍了MARIADB - 发送 QUERY 数据包时出错(不是 max_allowed_pa​​cket)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 PHP7 脚本将数据保存到数据库 (MariaDB) 时遇到问题.该脚本在以前的托管包上运行良好,但在我的新 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_pa​​cket = 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_pa​​cket)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆