In this post, we will show you How to Fix WordPress Error Establishing a Database Connection step by step?

WordPress is unable to make a connection with the database This is the main error occurs. There are a number of things that can affect your WordPress
The ‘Error establishing a database connection error can be caused due to some incorrect database information in your WordPress settings, corrupt database, or an irresponsive database server.
WordPress uses your Hosting database to store all of your website content and other data. Then WordPress connects to the database each time someone visits your website.
If any of these items like Password, Username are incorrect, so WordPress didn’t connect to your database server, and you’ll see this ‘Error establishing a database connection error. It is one of the most common WordPress errors which users face.
In order to solve this issue, we need to check two things i.e MySQL Database and wp-config.php file
For solve this error we need to check 2 things MySQL Database & wp-config.Php File
Below are the following data which WordPress uses to connect to the database
- Database name
- Database username
- Database password
- Database server
The above four information is stored in your WordPress configuration file i.e wp-config.php file. You need to check this information is present in wp-config.php matches with the MySQL database.
Step::1 Login to your hosting cPanel account

Step::2 Click on MySQL Database

Step::3 Next find your Database and the user associated with that

Step::4 In this new tab open File Manager section in your cPanel

Step::5 Click over the public_html and then find wp-config.php file(if your WordPress is installed directly in your domain otherwise go to the relevant folder where you have installed WordPress and look for wp-config.php file


Step::6 Click on the wp-config.php file and select Edit to see for all the information like database name, database username, database password etc..

Step::7 check the credentials details correctly with the information you see in the MySQL Database section

Step::8 In MySQL Database section Change the Database password

(For higher security to use Password Generator for generating the strong Password)

Step::9 After the password is generated, copy it and paste the same password in wp-config.php at the Database password field


Step::10 Click on Save changes once completed and check your website..


We hope this information helps guide you to How to Fix WordPress Error Establishing a Database Connection step by step