How to fix Error Establishing a Database Connection on WordPress?

This tutorial will help you if your WordPress website suddenly began to show "Error Establishing a Database Connection" but had been working for several months or even years. When this happens to your website do not quickly get worried, I have written this guide to help you understand the causes and how to fix them. However, if you are not sure or too busy to do it on your own, you can simply get in touch with me here so that I do it for you.

1) Wrong Database Credentials

You may wonder how really some simple mistakes can result in a day's problem. You may have mistakenly  changed your database password in error while following a tutorial on the internet for doing something cool. Once the password specified in wp-config.php is not correct your site will stop working immediately. If the database prefix has changed your site will stop working again.

2) Corrupt Database Tables

It is common your busy website with many plugins to have its tables corrupted but not really damaged in any way. Database corruption may be a result of changes in the MySQL server itself. When this happens your site will fail and stop loading immediately.

3) Plugin or Theme Conflicts

Usually WordPress plugins may conflict with each other. This also happens with themes in your installation. When a certain plugin is failing to work with another, it will give your WordPress an impression that your tables are corrupt in someway. That is how your site goes offline immediately.

4) Missing Database Tables

It is possible your tables may go missing due to several reasons. Your site may be infested with a virus which then starts eating out important tables. Plugin conflicts may also cause such problems to occur. You may have deleted or modified a table while following a tutorial which you did not fully comprehend. Once a WordPress database table is modified or is deleted the whole website will go offline.

5) MySQL Server is Offline

Your database server may actually be offline when you try to reach it throug your website. If MySQL server fails to start or is blocked by a firewall, it means all applications on that server will have that connection terminated thus causing your WordPress website to go offline.


MORE ARTICLES

How to install WordPress on CentOS 7 through Terminal?

Here is a simple guide on how to install WordPress on CentOS 7 without a...

READ FULL ARTICLE


How to setup a LAMP Server on CentOS 7 - Apache, MySQL, PHP?

In this tutorial I assume you already have either a VPS or a Dedicated Server...

READ FULL ARTICLE