WordPress数据库错误MySQL服务器已经停止查询

问题描述:

我得到这个错误这么频繁,php_error日志文件增加1MB每2秒。
,网站很慢。

I get this error so frequently that the php_error log file increases 1MB every 2 seconds. and the site is very slow.

我试图将这一行添加到wp-db.php

I have tried to add this line to wp-db.php

$this->query("set session wait_timeout=600" );

但没有帮助。

web服务器是IIS 7,最新版本的mysql和wordpress

The web server is IIS 7, latest version of mysql and wordpress

这个技巧将适用于所有的WordPress版本。打开Wordpress目录。该目录将包含以下文件夹:

This trick will work for all WordPress versions. Open your Wordpress directory. The directory will contain the folders :

wp-admin
wp-content
wp-includes

打开wp-includes。搜索wp-db.php文件。如果您找到该文件,请使用文本编辑器打开它。使用文本编辑器的搜索工具,搜索:

Open wp-includes. Search for the wp-db.php file. If you found the file, open it using a text editor. Using the text editor's search tool, search for :

$this->ready = true;

找到该行后,在找到的行后面添加以下行:

Once you found the line, add the following lines just after the found line :

//WP Query Gone Away Error Fix
$this->query("set session wait_timeout=600");

您也可以按 https://subinsb.com/fix-wordpress-error-mysql-server-has-gone-away 链接查看更多detials。

You can also follow https://subinsb.com/fix-wordpress-error-mysql-server-has-gone-away link to view in more detials.