PLEASE NOTE: “As an Amazon Associate, [Need Coffee] earns from qualifying purchases." You know we make money from Amazon links,
and I know you know this, but they make us say it anyway. More info, click here.

MySQL Server Has Gone Away – Why Doesn’t It Love Me Anymore?

If You Hadn't Gone Away

That’s right–maybe your MySQL server just isn’t that into you. Or maybe you’ve got a bit of a setup issue.

Here’s the shot: first up, it’s a good idea to keep an eye on your error logs. I reminded myself of this when I saw my MySQL server dying every so often (the MYSQLD process for people who care) and went to go check my error logs. In fact, I used to have a window logged into my server with tail -f error_log running so I can see errors in realtime. I’ve started doing that again.

Basically you go to your server’s statistics/logs directory at a prompt (this is Linux…no idea if Windows is different) and type “tail -f error_log.” That will just scroll the errors. If you just want to read the latest errors, you leave off the -f.

If you don’t have your own server and can only download the log file, I suggest doing it once a week. Set yourself a reminder in Outlook or whatever you use.

[ad#longpost]I was getting the lovely “WordPress database error MySQL server has gone away for query UPDATE wp_options SET option_value…” blah blah blah error. For all kinds of things. And when looking for the solution, I was reminded of this: Rob at Rob’s Notebook reworked the wp-db.php file to avoid such things. And surprisingly, searching for “WordPress database error MySQL server has gone away” took me a while to find that page. But I had used it before to fix the problem and it had worked–being senile, though, I had forgotten to put it back in place. I post this to let you know (and also to give myself a reminder six months from now when I forget again).

All of this to say: keep an eye on your logs. And check there first if something funky starts happening. They are your friends.

You know what else is your friend? The WordPress backup plugin. Use it often.