Question

WordPress droplet 'Error Establishing Database Connection' very often

Hello,

I’ve been having an issue with a WordPress droplet of mine that seems to go down quite often. In each time, when I go to the website I get ‘Error Establishing Database Connection’. The only way for me to resolve this is to restart the server, but it could be days before I realize that the droplet is down and a huge inconvenience. I am looking for guidance or some investigation into how to avoid this or why it is occurring.

Thanks, Marcus


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there Marco,

What I could suggest is following the steps from this tutorial here on how to tweak your MySQL configuration for better reliability:

https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

Additionally, I would recommend checking your MySQL error log so that you could get some more information on what might be going wrong. It sounds like the server might be running out of RAM.

If this is the case, I would suggest considering adding a bit of extra RAM and possibly a SWAP file:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04

Let me know how it goes!

Best,

Bobby