0

Today I have encountered a mysql server error... this actually happened twice... before was last week...

[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

My temporary solution for this was Restarting mysql server service... it works for now...

Can anyone tell me was possible triggers this or how can I possibly fix this?

P.S I have also tried increasing in my.cnf -> from max_allowed_packet=16M to max_allowed_packet=128M... I thought it fixed it, but it came back

1 Answers1

0

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");

Save the file. Now, when you check the error log of your site, you won’t see the error anymore which means that the site won’t go down as before.

This is just a temporary fix. You can’t be 100% sure that the error won’t come anymore. By doing this "fix", MySQL will wait for some time to finish a query. Here are some tips to fix this error permanently :

Try Disabling / Removing Very High Memory Needed Plugins Disable plugins one by one and find the plugins that cause this error Use plugins that you only need. More plugins means more C.P.U memory and MySQL server will be overloaded

Amritosh pandey
  • 404
  • 4
  • 11