今天我遇到了 mysql 服务器错误...这实际上发生了两次...之前是上周...
[29-Jan-2018 01:51:11 UTC] PHP Warning: mysqli_query(): Error reading result set's header in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:10 UTC] PHP Warning: mysqli_query(): MySQL server has gone away in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: mysqli_query(): Error reading result set's header in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:10 UTC] PHP Warning: mysqli_query(): MySQL server has gone away in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: mysqli_query(): Error reading result set's header in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: mysqli_query(): MySQL server has gone away in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: mysqli_query(): Error reading result set's header in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:10 UTC] PHP Warning: mysqli_query(): MySQL server has gone away in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: mysqli_query(): Error reading result set's header in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7546 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7609 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7553 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7579 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7607 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7593 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7524 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
[29-Jan-2018 01:51:11 UTC] PHP Warning: Error while sending QUERY packet. PID=7601 in /opt/lampp/htdocs/wordpress/wp-includes/wp-db.php on line 1924
我的临时解决方案是重新启动 mysql 服务器服务...现在可以使用...
谁能告诉我是否可能触发此问题或者我该如何解决此问题?
P.S 我也尝试在 my.cnf 中增加 -> 从 max_allowed_packet=16M 到 max_allowed_packet=128M...我以为它修复了它,但它又回来了
最佳答案
打开 wp-includes.搜索 wp-db.php 文件。如果找到该文件,请使用文本编辑器将其打开。使用文本编辑器的搜索工具搜索:
$this->ready = true;
找到该行后,在找到的行后面添加以下行:
//WP Query Gone Away Error Fix
$this->query("set session wait_timeout=600");
保存文件。现在,当您检查网站的错误日志时,您将不再看到错误,这意味着网站不会像以前一样宕机。
这只是一个临时修复。您不能 100% 确定错误不会再出现。通过执行此“修复”,MySQL 将等待一段时间来完成查询。以下是一些永久修复此错误的提示:
尝试禁用/删除需要大量内存的插件 一一禁用插件,找到导致这个错误的插件 使用您只需要的插件。更多的插件意味着更多的CPU内存和MySQL服务器将过载
关于php - MySQL 服务器错误 -> 服务器消失并发送查询数据包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48494162/