Getting Issue "Error establishing a database connection" On DigitalOcean

I have some issue like " Error establishing a database connection" on my website please look at the issue and give me the solution

i have tried with ee site restart --db
but its not working.

i have tried also sudo service mysql restart

it shows mysql not found.

please check the issue.


Updating your server fixes this issue(almost all the time for me). Login to your VPS via ssh and run following commands to update and reboot.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot

I have done this now site is working perfectly i mean homepage is working perfectly but inner pages have same issue like “error establishing database connection”

I always solve this issue with: ee service restart nginx-proxy && ee service restart db

Hi Paleo,

I’ve got a similar issue, the service restart works before.

I’ve encountered same issue again now, but it’s not working. Any idea how to debug this?


To debug this kind of issue, ee log show will be helpful.