How do fix the error establishing a database connection?

The database error ‘error establishing a database connection’ it means the php code was unable to connect your Mysql database to retrieve the information it needs to build the page. The error will be come in many reasons. Most of the time the database_name, database_user, database_password and localhost, if any of these four credentials are incorrect, you will get the “error establishing database connection” error.

Common reasons:

============

 

1.Incorrect login credentials

2.Corrupted WordPress files

3.Corrupted database

4.The database server is down

5.Too much traffic

6.Server not Available

How to fix the error “error establishing a database connection” :

Step 1: Get In Touch With Your Web Host Provider.

Step 2: Check If Your Plugin or Theme Files Haven’t Been Corrupted.

Step 3: Check If Your Database Hasn’t Been Corrupted.

Step 4: Check Your Database Connection Credentials.

Step 5: Restore The Default WordPress Files.

Before any attempt to fix the issue, you have to take a backup of your database. Export MySQL database through Export function.