The “error establishing a database connection” is probably one of the most common and frightening errors that WordPress users can encounter. This error means your website is no longer communicating or has access to your WordPress database, and thus your entire website goes down. This is not something to be taken lightly and you should try and resolve this immediately as this can directly affect your sales, traffic, and analytics.
But don’t worry, today we’ll discuss How to fix Error Establishing A Database Connection.
The ‘Error establishing a database connection’ issue can be caused by incorrect database information in your WordPress settings, corrupt database, or an irresponsive database server.
As a content management system, WordPress uses a database to store all your content and other website data. It then connects to the database each time someone visits your website.
So that you have to check following details,
Make sure that the following conditions are met,
Database name, database username and its password can be found in the wp-config.php file located in the root directory of your WordPress installation. In order to check these details, do the following,
Once you have found the database details in the wp-config.php file, the next step is to check if they are correct.
In cPanel click on MYSQL Databases and Carefully check if there is a database which name fully matches the one specified in wp-config.php file. If not check the all details which one matches or handle WordPress site.
Then scroll down and check the database username.
Now you need to make sure that the information for the database name, username, password, and database host is correct.
Find the user who handle your WordPress site then change the password.
Set New password.
Select all and Click on Make Changes.
Now set the all details in wp-config.php file. Make sure that the information for the database name, username, password, and database host is correct.