WordPress.org

Ready to get started?Download WordPress

Forums

WordPress database error: [MySQL server has gone away] (39 posts)

  1. 4evrblu
    Member
    Posted 7 years ago #

    I have encountered this error several times in the last 5 months on GoDaddy servers. Each time, GoDaddy has blamed WordPress.

    http://totalphysiqueonline.com/ was working just fine with 2.04-2.07 with the exception of the 3, now 4, [MySQL server has gone away] instances.

    Why is GoDaddy telling me the problem is with the template or with WordPress?

  2. drmike
    Member
    Posted 7 years ago #

    It should give you more of an error than that. Like where the server is disappearing. (ie an actual file name and line number)

  3. 4evrblu
    Member
    Posted 7 years ago #

    Here is a screen shot:

    http://totalphysiqueonline.com/carp.tiff

    The problem appears to be with my Live Feed script called CARP.

    When CAPR is removed, http://totalphysiqueonline.com/ loads just fine.

    When CARP is in place, you get http://totalphysiqueonline.com/carp.tiff

    Odd.

    Does the screen shot help?

  4. Kahil
    Member
    Posted 7 years ago #

    I too have been getting this recently. It only happened once I started using the new version of wordpress, 2.1.2. It was a completely fresh install too. It sounds like a bug? It has happened mostly on the Dashboard, which has no customizations on it.

  5. 4evrblu
    Member
    Posted 7 years ago #

    Well, when I removed the CARP things bascially were restored to normal, but I still had the CARP database running in the background. It's just that I removed the script that called the CARP database from my splash page.

    I am still having difficulty saving new posts and saving edits to old posts. This is rsulting in time outs. Strange.

    But most certaining CARP is doing something, because when I add it back the site refuses to load.

  6. 4evrblu
    Member
    Posted 7 years ago #

    Deleted duplicate post

  7. mlanger
    Member
    Posted 7 years ago #

    I have also been getting this error on a GoDaddy.com hosting account. I only seem to get it when I try to post a new entry using the WordPress interface (normally I use endo).

    The full error is as follows:

    WordPress database error: [Lost connection to MySQL server during query]
    DELETE FROM wp_postmeta WHERE Post_ID = 594 AND meta_key = 'sticky';
    
    WordPress database error: [MySQL server has gone away]
    INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES ('594','_pingme','1')
    
    WordPress database error: [MySQL server has gone away]
    INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES ('594','_encloseme','1')
    
    WordPress database error: [MySQL server has gone away]
    SELECT ID FROM wp_posts WHERE TRIM(to_ping) != '' LIMIT 1
    
    WordPress database error: [MySQL server has gone away]
    SELECT post_id FROM wp_postmeta WHERE meta_key = '_pingme' OR meta_key = '_encloseme' LIMIT 1

    When I check to see if the post was saved in WordPress, it is and everything is fine. But I don't like getting this error message and would like to fix it if it's broken.

    That site's running WordPress 2.0.4.

  8. 4evrblu
    Member
    Posted 7 years ago #

    I decided to switch to Host Gator because GD refuses to deal with the issue. This has been ongoing since I went with GD, and I am convinced the issue is with hos GD runs their shared database servers.

    I may be wrong about my assumptions, but their refusal to even consider the possibility was enough to lose my business.

  9. 4evrblu
    Member
    Posted 7 years ago #

    PS: I too noticed that in spite of the errors, posts are saved. It is quite annoying to have your site time out over and over and then discover that all your waiting was pointless because the changes were saved. It wastes tremendous amounts of time.

  10. 4evrblu
    Member
    Posted 7 years ago #

    PS: I too noticed that in spite of the errors, posts are saved. It is quite annoying to have your site time out over and over and then discover that all your waiting was pointless because the changes were saved. It wastes tremendous amounts of time.

  11. Hops
    Member
    Posted 7 years ago #

    I'm getting a ton of this lately too. Sometimes the site loads fine, other times it grinds to a blank page. Other times it give me the database has gone away error. The Dashboard definitely does not agree, either. I use GoDaddy. Is the only solution to switch hosts?

  12. 4evrblu
    Member
    Posted 7 years ago #

    Well, I don't honestly know, but GD keeps telling me that we have to "optimize our script" for wordpress and yet they OFFER WordPress as one of their freebie software packages.

    I think GD is full of crap. So yeah, I decided that switching hosts was my best option.

    If you switch hosts though, do your research. I have found that Host Gator is highly thought of and highly rated by every host rating survey I have found. Once I switched, I found their 24 hour live chat tech support to be very helpful as well as fast. Their CPANEL, once you get use to is, is great. It is the equivalent of Host Manager Control Panel.

    The database management is a bit different from GD in that Host Gator names their DB files uniquely. This means that you will have to back up all your GD databses and then import their content to your new databases at Host Gator. That is not hard to do, but because Host Gator names the databases a bit differently from what you are use to at GD, you will need to adjust your new wp-config file to reflect changes in DB User, DB Name, DB Password etc.

    Also, if you switch, make sure you keep your GD account active until you are absolutely certain your new site at Host Gator (or whatever service you choose) is working.

    Host Gator will also do a migrate of your entire root directory for free, but they warn (and correctly so) that some files might get left behind during the transfer process. So, once a transfer is done, you will want to check your newly relocated image/content folders for all your image files, plugins and related images, themes and related images, uploads folders etc.

    To help with this, what I chose to do was back up my entire WordPress directory onto my local machine as well as keeping my GD web site active.

    Once the transfer is complete (about 24 hours), I changed my GD name servers to Host Gator name servers, pointing my domain to Host Gator servers. That way, I could test my new site at Host Gator servers. Once I figured out what needed to be tweaked, I switched BACK to GD name servers so that my old site would have as little downtime as possible.

    I am now doing some tweaking of the new site, using an FTP program to upload any and all straggler files, updating wp from 2.07 to 2.09 etc. Once all that is done, I will change the nameservers once more to point to Host Gator. Hopefully by thien it will all work smoothly.

    If you have any trouble, come back to this thread and post your questions.

  13. mlanger
    Member
    Posted 7 years ago #

    I want to confirm that GoDaddy is being completely unhelpful about this. I now have one of my blogs "grinding to a halt" (as someone else noted above) while loading. After a certain point, the "MySQL server has gone away" error message appears at each point that data from the database should appear on the page.

    I called tech support and they claimed that they checked the connection on my database, but they never asked me which one was having the problem and they refuse to admit that they made changes in the settings to MySQL or PHP on their side. If they didn't change anything and I didn't change anything then why am I having these problems?

    GoDaddy was down for a bunch of hours right before this problem started. I wonder if something screwy happened then. I just wish they'd stop denying the problem and research it.

    Right now I'm on hold waiting for another person to pick up. I think they try to drive you nuts with their hold music.

  14. mlanger
    Member
    Posted 7 years ago #

    I just spoke to a GoDaddy supervisor and got this problem escalated.

    It's VERY important that anyone who is having this problem get in touch with GoDaddy support and tell them about it. Be sure to use the exact error message, "MySQL server has gone away" and tell the support person that the problem has been escalated and you might have additional information for the admins.

    The problem appears to be timeout related, as it happens about 95% of the time on one of my sites that has a lot of database queries. That site is still on WordPress 2.0.4.

    All of my sites display the error message when I post new content or edit existing content, even though the new or revised post appears online okay.

    I don't want to move to a new server. I just want this fixed. Trouble is, so many people call GoDaddy with questions about WordPress that aren't GoDaddy-related (plugin errors, coding errors, etc.) that GoDaddy support is "programmed" to simply refuse to help. Then, when we have a real problem that may really be related to the server, we can't get them to look at it.

  15. 4evrblu
    Member
    Posted 7 years ago #

    Good point.

    Trust me, I did the excalation thing. I got no where.

    The reason I got nowhere is because from their end they claimed that they saw no problem and everything appeared to be working normally.

    Yes, I gave them the exact error. I gave them a laundry list of what was going wrong with my site and they told me everything looked fine from their end.

    I would be interested in knowing if they fix the problem for you. In my case, they didn't. In my case, the refused to look at it any further.

  16. 4evrblu
    Member
    Posted 7 years ago #

    Here is a follow-up to my site transfer:

    Transfer

  17. mlanger
    Member
    Posted 7 years ago #

    Well, they did see the error. And they did look into it. And this is what I just got from them:

    "The error that you are receiving indicates that your MySQL Queries are taking an excessive amount of time and are timing out. We are not able to assist you in resolving this issue as this is a coding issue."

    A coding issue? All of a sudden? I haven't changed anything. Why would my queries suddenly be taking longer?

    Can someone knowledgeable about the inner workings of WordPress please step in here and explain why my queries should suddenly start taking longer?

  18. 4evrblu
    Member
    Posted 7 years ago #

    Well, this is exactly what I ran into. If WordPress is so bad, then why do they make it available?

    Moreover, if this is merely a coding issue, then why did my site work sometimes, and sometimes not work? Makes no sense.

    What has changed are Go Daddy Database servers.

    I am at Host Gator now, and I have been posting and editing my site all day and not once have I run into a single issue.

    Go Daddy sucks.

    So far Host Gator rocks.

  19. Kahil
    Member
    Posted 7 years ago #

    I don't think that it is a GoDaddy problem. I have GoDaddy as my host. For me, the only problem I have had with this was on the Dashboard. It only happened in those sections that import outside data. To fix it, I simply edited the index file in the wp-admin folder so that it no longer called the bottom feed. Ever since it has yet to happen again.

  20. openadvent
    Member
    Posted 7 years ago #

    hi,

    the problem isn't on the host
    it's more due to the problem of mysql server.

    if you refer to http://www.vbulletin.com/forum/showthread.php?t=43505

    it shows that mysql might time out on your connection.
    especially when mysql_connect in php actually reuse your old connection when calling mysql_connection (which is alike ms$ connection pooling )

    so, my suggested solution is to set the 4th parameter of mysql_connection to true, to makesure php does not reuse existing connection.
    and then do a ping to the server.

    mysql_ping

    do the ping on query function, right before query is done.

    For my modified file:

    http://www.openadvent.com/blog/?p=30

  21. 4evrblu
    Member
    Posted 7 years ago #

    This is a great reply. I bet this is what would have fixed my problem and everyone else. I wish i had found the solution before making the switch! Hmmm.

    Oddly enough though, if this is how simple the fix is, why doesn't Go Daddy know this? The problem seems very common. Seems to me that this is what Go Daddy database techs would want to know.

    ::)

  22. 4evrblu
    Member
    Posted 7 years ago #

    Duplicate post deleted

  23. Will Taft
    Member
    Posted 7 years ago #

    @openadvent: I am not too good at this yet so just want to confirm I understand. To avoid this issue, just insert the following and then set the line after the dashes below to have >dbpassword, "true"); These are the only changes needed to fix?

    Thanks!

    $this->dbuser = $dbuser;
    $this->dbpassword = $dbpassword;
    $this->dbname = $dbname;
    $this->dbhost = $dbhost;

    $this->connecttodb();
    }

    function connecttodb()
    {
    --------------------------------------

    $this->dbh = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword, true);

  24. openadvent
    Member
    Posted 7 years ago #

    hi 4evrblu,
    hope it helps :)

    WT,

    you need to copy the function checkconnection()
    as well.

    and also alter your query function to call checkconnection before query:

    function query($query) {
    // filter the query, if filters are available
    // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method

    $this->checkconnection();


    http://www.openadvent.com/blog/?p=30#more-30

  25. Kahil
    Member
    Posted 7 years ago #

    at first I thought that mine was doing because it was erroring out when trying to load the sections that involved outside data. I was wrong... it eventually happened to me as with everyone else. This fix seems to have worked. Thank you...

    Has anyone entered this in as a bug?

  26. arm0110
    Member
    Posted 6 years ago #

    Joining in on the thread a bit late...I'm having the same trouble on my WP website when trying to work in Admin. Saving posts, managing comments, deleting spam all result in this error. I'm not familiar with the intimate workings of MySQL, but I do know how to login to MySQL and backup my database, so if someone could point me in the right direction on how to execute this fix, I would greatly appreciate it. I'm pretty sure it's the time out issue as mentioned by openadvent, and I just need to understand how to find the things that need modification.

  27. Dash
    Member
    Posted 6 years ago #

    That's a good fix, although it still takes a long time to edit and upload posts.

    arm0110, just follow the link to openadvert's blog, then download the php file and replace your own file. wp-includes/wp-db.php.

    It's not a bug, at least on WordPress's end. I run two blogs, one using WordPress version 2.0.5 and the other using 2.1.3.

    Both blogs were affected at the same time. Both blogs are hosted by GoDaddy, but on different hosting plans and therefore using different MySQL databases.

    One database is version 4.0, the other is version 5.0.

    It looks to me like it's GoDaddy's fault completely.

  28. Will Taft
    Member
    Posted 6 years ago #

    Thank you openadvent! Just came back to this after getting distracted for a couple of weeks. My site was generating the infamous "gone away" message when anyone used the contact form. After clicking "send", indeed it took 10 seconds or so to send it. This caused the error message. I just downloaded your php file and replaced mine and the error no longer is popping up. The form still takes 10 or 15 seconds to send, but the error is gone.

    Now, if there was only such an easy solution to the common error where new users do not get their initial sign-up or "forgot password" emails.

  29. sturtus
    Member
    Posted 6 years ago #

    Can anyone say if this fix is 2.0.9 compatible?

    I had a similar issue with GoDaddy. I migrated the database from 4.1 to 5.0 and the MySQL errors, specifically the "gone away" message disappeared. However, any page may or may not load completely blank at any time, and caching has been turned off.

  30. sturtus
    Member
    Posted 6 years ago #

    The site in development:

    http://test.common-mound.com

Topic Closed

This topic has been closed to new replies.

About this Topic