SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2012
    Location
    New Hampshire, US
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WordPress database error MySQL server has gone away for query SELECT.....

    Hello, this is my first post, thank you for any help you can offer!

    Some background: I manage and host just over 20 WordPress websites on a managed VPS from a reputable hosting provider. The VPS has 1 GB ram and I believe it's powerful enough to host these sites (my host says so as well), they are generally low traffic in the overall scheme of things.

    Checking the error_log file in public_html, I'm seeing many error entries, most go like this:
    [16-May-2012 08:30:46] WordPress database error MySQL server has gone away for query SELECT.....and then it's related to a plugin or general WordPress functions.

    I try to keep my plugin use to a minimum and the plugins I use are pretty standard. The other interesting thing is that I manage a couple other WordPress sites that are hosted on shared hosting with other companies, I'm not seeing these errors on those sites.

    I'm pretty sure all these database errors are affecting the load speed and overall speed of these sites. I've done some research online and seen suggested fixes of modifying wp-db.php file, but this would be very inconvenient on 20+ sites and every WordPress update. I've contacted my host and they've adjusted some settings like max_user_connections and wait_timeout. Some of their final advice was "I think that consulting with a qualified DBA to optimize slow queries and the overall database performance would return better results."

    It seems like hosting about 20 relatively low volume WordPress based sites should be manageable with a good VPS (and I'm open to upgrading the RAM or to their next level of hosting). Do I really need to hire a DBA or do you think I need to push my host more to help me?

    I'll attach a screenshot showing some server statistics from the past 30 days.

    Screen Shot 2012-05-17 at 11.54.16 AM.png
    Screen Shot 2012-05-17 at 11.54.48 AM.png

    Additional stats, but only 1 day time frame:
    Screen Shot 2012-05-17 at 12.04.15 PM.png
    Screen Shot 2012-05-17 at 12.04.26 PM.png

  2. #2
    SitePoint Member lawstevefthit's Avatar
    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    with word press i always keep backup files for ftp that way when wp goes to sh*t then i just reupload the latest files that i know worked

  3. #3
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    4,994
    Mentioned
    100 Post(s)
    Tagged
    0 Thread(s)
    Is it always the same query? If it is search you code for the file that the query is in, that should identify if it's a main part or a plug-in. Are all occurances of the wordpress core and any plug-ins up to date?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  4. #4
    SitePoint Member
    Join Date
    May 2012
    Location
    New Hampshire, US
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do keep all the sites up to date, both the WordPress core and plugins. It's not the same query, it's everything from plugins to what looks like basic WordPress functions.

    For instance, this looks related to basic WordPress navigations:
    [17-May-2012 11:36:57] WordPress database error MySQL server has gone away for query SELECT t.*, tt.* FROM hmj_terms AS t INNER JOIN hmj_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'nav_menu' AND t.name = '14' LIMIT 1 made by require, require_once, include, get_header, locate_template, load_template, require_once, wp_nav_menu, wp_get_nav_menu_object, get_term_by

    And then I think this is plugin (WooCommerce) related:
    [17-May-2012 11:36:56] WordPress database error MySQL server has gone away for query SELECT * FROM hmj_woocommerce_attribute_taxonomies; made by require, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, do_action_ref_array, call_user_func_array, WC_Query->pre_get_posts, Woocommerce->get_attribute_taxonomy_names, Woocommerce->get_attribute_taxonomies

  5. #5
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm having what appears to be the same problem - I have a single site set up on a HostGator VPS server. The site has a reservation system plugin I wrote that is very system intensive (CPU, queries, etc.). It is only recently that this problem started - June 9, 2012. I did update some plugins, but not sure it is related to that. My other sites on HostGator shared hosting (reseller plan) don't seem to have this issue.

    I'm going to try the solution that requires editing /wp-includes/wp-db.php to increase the query wait_timeout, but I agree that this hack is not sustainable long term (http://thesocialmediaguide.com/wordp...away-for-query) - at least it would only be this site.
    Brad Trivers
    Sunrise Solutions, Inc.
    PEIStuffOnline.com

  6. #6
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just found a response to this post - http://www.wptavern.com/forum/plugin...way-query.html - from Otto who is a trusted WordPress developer / expert. I think that my problem is likely "Seriously overloaded database server.". Not sure if the wp-db.php hack will help in this case. It is quite possible I've mis-configured the VPS too since I don't set them up very often.

    "MySQL server has gone away" is a generic error. It happens when the connection between the site and the database times out and the connection auto-closes.

    Primary cause: Seriously overloaded database server.

    Secondary cause: The mysql server restarted, killing all current connections in the process.

    Other possible causes:
    - Stupid configuration. Usually due to stupid sysadmin.
    - You sent a query that was too large. The default max query size is 1 MB, so this is unlikely.
    - DNS failure. mysql relies on name resolution, it can't tell the difference between network timeout and DNS being borked.
    - mysql bug. Not uncommon, but rare to see in real life usage.
    - Your tables got horked up in a way that actually crashes mysql when it tries to access them. Rare, but possible.
    Brad Trivers
    Sunrise Solutions, Inc.
    PEIStuffOnline.com


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •