Report this

What is the reason for this report?

Droplet Management Basics

Posted on November 10, 2015

Hi, some of our droplets (running wordpress) are experiencing the dreaded: “error establishing a database connection”

It’s happening too much for my liking and we are considering a moving away from DO if we can’t resolve it soon.

I am trying to learn SSH commands for logging in and controlling / managing a server.

The droplets are Wordpress sites running on Ubuntu.

I understand how to login, but i am sure there are a lot of useful commands i need to learn such as restarting the server etc.

I would greatly appreciate any help you have on this, and any commands which you think would be useful based on the above setup (Ubunto / Wordpress)



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!

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.

Why would it make you move away from DO? You’ll run into it with any VPS no matter where. Check your syslog for OOM killer on mysqld. If it’s there, upgrade your droplet or use less RAM.

@mosaic - Errors are not specific to DigitalOcean and could pop up for any number of reasons on any VPS deployed to any provider and at any time if the software, MySQL in this case, is not tweaked and / or tuned properly. You could “downgrade” to shared hosting, though you would, as a result, lose the ability to customize your server and would thus be stuck with whatever configuration the shared host sets.

The specific connection error that you’re referencing could be due to poor configuration (such as RAM being over-allocated), lack of configuration or problems elsewhere. To really dive deep in to the error and the configuration, MySQL Tuner should be used (as I referenced in another post of yours IIRC). It will allow you to see how much RAM could potentially be used by MySQL (note: if MySQL is configured to use more RAM than the Droplet is allocated and swap won’t cover the excess, MySQL is going to crash as MySQL will use whatever it’s allocated).

That said, there’s not a specific one-shot variable that tells MySQL how much RAM it can use (when compared to MemCached or Redis, which has one configuration variable for RAM allocation). MySQL uses a combination of InnoDB settings as well as buffers, query cache etc to allocate RAM. If these are set too high, MySQL will naturally crash as a result of lack of RAM/Memory.

Problem solved with this code…

sudo start mysql

Regards, Beautiful Jogja - Indonesia

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.