How to fix "Error Establishing database connection" in WordPress?

Posted by Sakshita

How to fix "Error Establishing Database Connection in WordPress?

WordPress website are directly related to database. This is because WordPress has various features that not only simplifies user work but also allow them to conveniently manage the website.Thus, any mistake in the database will make your website to respond in improper way. So, it is very important to manage the website presentation and its database as well. 
Today, in this article I'will discuss about one of the error that can be occurred in any WordPress website and discuss the way to fix it as well.
WordPress Error
"Error Establishing Database Connection" is the error that occurs because of one or many reasons. So, before getting to know about the solution it would be better to know the reason because of which it occurred.
But the most important reason is when WordPress is unable to contact with its database. This happens when there is any mistake in wp-config.php file which is responsible for establishing a connection between database and server.
wp-config.php is one of the important and sensitive file of WordPress and any mistake in this file leads to an error of "error establishing database connection".
Now, let us see what are the steps that can be taken to fix the error. 
First we will check the database details related to the WordPress website. This can be checked via cPanel which is associated with the particular WordPress website.
  • Login to cPanel and get inside File Manager section.
WordPress hosting
  • Get into the domain directory of WordPress and then WordPress installation directory.
  • Right click over wp-config .php file and then View.
File Manager
  • On the next page, you will see all the details related to WordPress database as given in the below image.
WordPress database
  • Note down the database name, username and password and then go back to cPanel feature list page.
  • Select MySQLDatabase and proceed.
  • On the next page, check the database name and user as given in wp-config.php file.
  • From the above given image, it can be concluded that database name and user is correct. Thus, the error does not occur because of these two.
  • Now, change the password of the particular user. Scroll down to Current Users section and then click over Change Password.
  • On the next page, enter the new password as per your choice and then Change Password.
  • Copy and Paste the New Password in wp-config.php file and Save Changes.
Now, visit your WordPress website to check if the issue has been resolved or not.
Thus, with the above given procedure you will successfully fix the "error establishing database connection".
Hope this may help you.

Cheap Web Hosting                                             Cheap Reseller Hosting

Comments