I recently developed a WordPress site on a spare domain name I had, on a shared host. I’ve moved that site to the owner’s home server, and now when they are trying to edit the site, the following error log (and others like it) are being generated, resulting in te MySQL server being shut down.
[Wed May 01 17:36:00 2013] [error] [client 24.118.238.85] WordPress database error MySQL server has gone away for query SELECT wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/vanguard/404.php’), the_widget, WP_Widget_Recent_Posts->widget, WP_Query->__construct, WP_Query->query, WP_Query->get_posts, referer: http://www.hugoautoparts.com/wp-admin/post.php?post=1767&action=edit
[Wed May 01 17:36:00 2013] [error] [client 24.118.238.85] WordPress database error MySQL server has gone away for query SELECT t., tt. FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN (‘category’) ORDER BY tt.count DESC made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/vanguard/404.php’), wp_list_categories, get_categories, get_terms, referer: http://www.hugoautoparts.com/wp-admin/post.php?post=1767&action=edit
What I have done so far:
- Edited the wp-db.php file to add $this->query(“set session wait_timeout=600” );
- Verified the wait_timeout variable in phpMyAdmin -it’s set to 28,800
The errors are happening still, when the owner is trying to update the WordPress site.
Check the error log for mysql, it’s not really possible to give any good advice based on the information you have provided.
It’s located in /var/log/mysql/error.log or /var/log/mysql.err on most linux installations.
My guess is that there is either something wrong with the mysql installation, and then you should reinstall it, or that there is a hardware error with the server that makes the mysql server crash.
Here is a very good explanation:
“Wait_timeout” is certainly something to look at, but it’s not the whole story.
It looks like you’re also going to need some code to check for “stale connection” and attempt to reconnect. Some more links:
Rob’s Notebook (above)
http://www.nsp-code.com/wordpress-plugins/wpdb-ping/
http://thesocialmediaguide.com/wordpress-blog/solution-for-wordpress-database-error-mysql-server-has-gone-away-for-query
http://wordpress.org/support/topic/wordpress-database-error-mysql-server-has-gone-away-4
‘Hope that helps ..