Introduction
WordPress is one of the most popular open source content management systems in the world. Although it started out focused on blogging, over the years it has developed into a more flexible platform for websites in general. After almost fifteen years of development it is quite polished and robust, yet issues can still come up.
If you've recently attempted to load your WordPress-powered website and instead saw a message stating "Error Establishing Database Connection", the cause is most often one of the following:
- The database has crashed, often due to the server running out of memory
- The database login credentials are incorrect in your WordPress configuration
- The WordPress database tables have been damaged
Let's walk through these issues one at a time to determine if they affect you, and how to fix them.
Prerequisites
This tutorial assumes the following:
- You're running WordPress on a machine that you have command line and
sudo
access to - Your database is running on the same server as WordPress (typical of a self-hosted WordPress setup, less typical of a shared WordPress hosting environment)
- You know your database username, password, and the name of the database created for WordPress. This information should have been created during initial setup of your WordPress install.
Step 1 --- Check the Server Memory Resources
A good first step for debugging this problem is to try logging into the server to see if the system is healthy and MySQL is running.
Log into your server via SSH, remembering to replace the highlighted portions below with your own user and server details:
ssh sammy@your_server_ip
Copy
If you need help logging into your server, please see our article How To Connect To Your Droplet with SSH.
Top comments (0)