Error establishing a database connection even after restarting service

Hi All,

I’m using easyengine 4.0.17 to build my wordpress site, hosting using DigitaLocean, Ubuntu 18.04.3 (LTS) x64, 1 GB RAM.

I’ve got error like this when visiting /wp-admin

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost . This could mean your host’s database server is down.

  • Are you sure you have the correct username and password?
  • Are you sure you have typed the correct hostname?
  • Are you sure the database server is running?

If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

I’ve tried to follow the advices that seems to work well on this cases: ee service restart db, gives this output:

Restarting services_global-db_1 … done

Success: Service global-db restarted.

But it’s still not solving the issue.

I checked the db name, user name, password in wp-config.php, it’s align with what I see from ee site info

Can someone guide me to fix the problem? Thank you!

Best Regards,

If you type docker ps you should get a list of running containers. Look for any containers that are constantly restarting or have a running time that is considerably less than all the other containers listed. Chances are that is your culprit. Next you can view the logs for that container by typing docker logs container_name That should give you a clue as to what is causing the issue.

As an example, I have had tons of issues with the newrelic module in PHP since 4.0.17. For some reason, despite not running newrelic, the php container is trying to parse the newrelic.ini file and is spitting out a ‘no such file or directory’ error and the container fails. I have run the ee service disable newrelic-daemon command to no avail. I have to modify the docker-compose.yml file for the site and remove all mentions of newrelic from the file. Then a quick docker-compose up -d rebuilds the site and it runs fine until the next time I have to disable and re-enable the site.

If you are not familiar with the file structure, individual site’s docker-compose files are located at /opt/easyengine/sites/

Obviously, you errors may be different. Start with the logs for the failing container.