Searching for something ?
Chetan Gole's Weblog.
Chetan
  • home
  • About
  • Contact
  • Categories »
    • Blogging
    • Images
    • Internet
    • Mobile
    • My Computer
    • Personal
    • Programming
    • Throughout
  • Archives »
    • March 2010
    • February 2010
    • January 2010
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • May 2008
    • April 2008
    • March 2008
    • Archive Page
  • WP-Plugins »
    • WP-CopyProtect
    • Smooth Scroll
  • Add to Google

Blogging

WordPress database error MySQL server has gone away for query in Wordpress 2.7

13.12.08 | 8 Responses
ADS BY GOOGLE

ico_wp_databaseRecently i optimize my Wordpress for performance with many tweaks like deleting useless tables from database. Installed WP-Super cache, etc.
I was checking the error_log file in my Filemanager i was shocked due to its size, it was 14MB large !. I download it and opened it, all the errors were related to Database.
Almost all lines were starting with
“WordPress database error MySQL server has gone away for query…..”
and few were like this
“WordPress database error Lost connection to MySQL server during query for query…..”

As per the Error statement, the error clearly notifies that the connection between the Wordpress and MySQL database was not proper. I just searched Google and seen many results, then i got the idea that its a General problem for many wordpress users.

Rob given a solution for this problem with few patched files to be replaced, You can read his article “Workaround for WordPress database error“. The article give detailed information about this problem. He also given files to be replaced to solve this problem.

According to him, This error is cause due to improper coordination between database and Wordpress PHP commands.

According to Rob ,

When someone tries to view one of your Wordpress web pages, the PHP code first opens a connection to the MySQL server. Subsequent queries to the MySQL server rely on the connection remaining open, and do not re-open the connection. If the connection to the server happened to have shut down before a query is made, then Wordpress will display this error.

So for that you need to change the value of “wait_timeout” variable, either ask your hosting admin to do it for your else you can do it by your self by tweaking your wordpress file named wp-db.php.

Rob given replacement files for Wordpress upto version 2.6.1 but recently Wordpress 2.7 is released so how to do the patch for Wordpress 2.7 ?

Here i am including the file to be replaced by original “wp-db.php” file for Wordpress 2.7.

Original wp-db.php
Workaround wp-db.php

Make sure you Backup your database and other files.

In above Workaround file, i just added

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

in line number 334 in original file.

So do Check your Error log file today, else this may cause increase in your site loading time.

Post to Twitter Post to Digg Post to Facebook Post to StumbleUpon

ADS BY GOOGLE

Possibly similar posts

  • TheChetan.com shifted their servers to hostgator :)
  • How to install Wordpress locally on Windows PC to test.
  • Create Yahoo email IDs free and fast (Yahoo ID maker)

8 Comments

  • Nihar said:
    Dec 16, 2008 at 2:53 pm

    I have encountered this. i WILL TRY THIS SOLUTION OUT.

    Reply to this comment

  • Salwa said:
    Dec 22, 2008 at 6:16 pm

    I have never encountered this before but thanks for the information. It is always good to “know”

    Reply to this comment

  • cwxwwwxwwxwx said:
    Dec 24, 2008 at 1:07 am

    well, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch ;)

    Reply to this comment

  • Tom Aquinas said:
    Jan 5, 2009 at 5:54 am

    Thanks for the help!

    Reply to this comment

  • Slim0123 said:
    Feb 8, 2009 at 12:00 pm

    But why would a query take that much time??
    I don’t think this happens except for the case that you are installing something new(it took longer only when I tried to install 60 plugins at the same time)
    There must be something else taking time (may be some backup plugin or something like that).

    Reply to this comment

  • PiterKokoniz said:
    Apr 8, 2009 at 8:42 am

    Hi !! ;)
    My name is Piter Kokoniz. oOnly want to tell, that I’v found your blog very interesting
    And want to ask you: what was the reasson for you to start this blog?
    Sorry for my bad english:)
    Thank you:)
    Your Piter Kokoniz, from Latvia

    Reply to this comment

  • Vikas said:
    Aug 11, 2009 at 10:55 am

    I had changed the wp-db.php file but the same error occurs when i reply to any post,

    If you have any solution regarding this please send.

    Thanks in advance

    Reply to this comment

Trackbacks

  • • TheChetan.com shifted there servers to hostgator | TheChetan.com

speak up

Add your comment below,

Be nice. Keep it clean. Stay on topic. No spam.

* Required Fields

Cancel

  • « Mumbai Terrorist Attack – Now whats the future of TAJ and Oberai ?
  • » Hit George Bush with shoe – The Flash Game

Subscribe for updates

Subscribe to RSS Feeds RSS updated or Subscribe via E-mail.

You can also subscribe for SMS Updatessms updated (Powered by Google)

recent posts

  • How to get answers for free from Expert-Exchange.
  • Nagpur PHP Meetup – How to secure your WordPress Blog.
  • New mobile from Google – Nexus One
  • Now … Firefox for Mobile – The Firefox fennec.
  • Year 2010 is here .. Happy New Year !!
  • Is Google’s Orkut using ASP.Net on Linux ! ? ! ?
  • Finally windows 7 is here….
  • Twitter

    Chetan_Gole :

    Twitter Updates

      follow me on twitter
    • Catch me on

      twitter Digg Stumble technorati Orkut facebook MBL Youtube LinkedIn BlogCatalog
    • Be my Friend.

    •  

      December 2008
      M T W T F S S
      « Nov   Jan »
      1234567
      891011121314
      15161718192021
      22232425262728
      293031  
    • Ranks

      Google Pagerank 5

      Subscribe

    • Ads

    • Tags

      Airtel Best Browser blogging Broadband Browser BSNL Dataone do follow Download Firefox Free Freebie Free DVD Gmail Google GPRS hacks Images India Internet Internet Explorer Linux Microsoft Mobile Mozilla My Computer Nokia Pagerank regedit router Security SEO Server SMS Sony Ericsson speed Stickers Tricks and Tips Ubuntu uTorrent Webmaster Windows wordpress world yahoo
    • Firefox !!

      Download Firefox

      Its Free


      Also Read all
      Firefox related posts

    Back to Top ↑
    Creative Commons License TheChetan.com is Blogged by Chetan Gole. All trademarks mentioned on this page are the property of their respective owners.
    Copying the blog content is allowed BUT the linkback MUST be given to respective post as a source. [CC Licenses Attribution-SA 2.5].
    PRIVACY POLICIES | DISCLAIMER
    Proudly hosted at HostGator