WordPress database error MySQL server went to query

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

I tried adding this line to wp-db.php

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

but it did not help.

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

+4
source share
2 answers

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

 wp-admin wp-content wp-includes 

Open wp-includes. Locate the wp-db.php file. If you find the file, open it with a text editor. Using the text editor search tool, search for:

 $this->ready = true; 

After you find the line, add the following lines immediately after the found line:

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

You can also follow https://subinsb.com/fix-wordpress-error-mysql-server-has-gone-away for viewing in more detailed posts.

+2
source

Run SHOW STATUS WHERE Variable_name LIKE '%onn%' to find out how many open connections you have. My looks like this:

 Variable_name Value Aborted_connects 1 Connections 629 Max_used_connections 3 Ssl_client_connects 0 Ssl_connect_renegotiates 0 Ssl_finished_connects 0 Threads_connected 2 

Run SHOW PROCESSLIST to find out which processes are active.

The problem may be that you are opening too many connections and not closing them. Running these commands will at least give an idea of ​​what might be the problem.

+1
source

All Articles