Are you experiencing the Error establishing a database connection error on your WordPress website? This fatal error can make your website entirely inaccessible to users – so, in this knowledgebase article, we’ll walk you through exactly what to do when you experience this issue.
All the information on your website is stored in your database except for the media content. When a user visits your website, PHP executes the code and queries the information from the database, and is then displayed to the user in their browser.
However, if this isn’t working properly then you get the error establishing a database connection. The entire screen is left in a blank state as no data can be retrieved due to loss of connection to the database.
Let’s look at the potential causes of this error:
Database Connection Issues – Potential Causes
- One of the most common reason is that your database login credentials are incorrect. Your WordPress website uses different login information to connect to its database.
- Your database is corrupted. The database gets corrupted due to a missing or corrupted table. This can also occur when some data is accidentally deleted.
- Issues with your database server. A number of things could be wrong on the web host’s end. This is common in shared hosting as it utilizes the same resources for a lot of users on the same servers.
How to Fix the Error Establishing a Database Connection
1 Check Your Database Login Credentials
This is the most common reason for this error. Hence please check the connection details for your WordPress site stored in the wp-config.php file which is generally located at the root of your WordPress site.
2 Repairing Corrupt Database
There are chances that your database might have been corrupted. This occurs when very often when the tables are added or removed by new plugins or themes. You can check our troubleshooting guide and solve this error.
3 Issues With Your Database Server
If none of the above has helped resolve your issue, then we highly recommend checking with your hosting provider as it could be an issue with your database server. The hosting provider can further assist you to solve this error.
Was this article helpful?
Still need help?
Submit Your Question
Please give us the details, our support team will get back to you.