• Some days when I go to my site, I just get the famous old database connection error, but since it doesn’t happen when I’m using the site, I can’t think of what could be causing it. Stranger yet, rebooting the server fixes the issue.

    Any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Did you try the basic troubleshooting techniques like – changing your theme to default WordPress theme and then reverting back to your themes or disabling your plugins one by one and see if it fixes the issue.

    Thread Starter tenhourguy

    (@tenhourguy)

    My theme is the default (Twenty Sixteen).

    Um… I could try disabling plugins one by one but that could mess up my site’s functionality a little, especially as I’d have to leave each one disabled for several weeks since the error timings are inconsistent.

    I suspect my database optimiser plugin is to blame but nothing goes wrong when manually running it and the database errors occur at inconsistent times rather than after midnight, when it runs automatically.

    Hmm… Sorry for being so vague. :/

    Thread Starter tenhourguy

    (@tenhourguy)

    Okay, at www.ads-software.com/support/topic/seemingly-random-error-establishing-a-database-connection, this person has the same issue and even the same host. I’ll try adding a swap file, perhaps the same size as my RAM later, since 512MB isn’t a great deal.

    Does that sound reasonable?

    If that’s your own server, you need to look at the logs: mysql logs for crashes, raw logs for traffic spikes that could cause loads, etc. It’s really got little to do with WordPress at this point; it sounds like server admin. Nothing in WordPress is going to cause intermittent database connections unless it is a plugin running wild. Check your logs and php configs, MySQL configs, etc. If you have definite errors in logs, try https://serverfault.com/

    Thread Starter tenhourguy

    (@tenhourguy)

    Thank you, Mark. I will look into how to view logs, but if it is just a lack of RAM then it’s probably no big deal.

    Thread Starter tenhourguy

    (@tenhourguy)

    Whoops. Forgot to leave an update!

    I added some swap and it’s been fine ever since.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Random “Error Establishing A Database Connection” Errors’ is closed to new replies.