Error establishing connection with database

Most of us uses word press to create website and to write blogs. Because this the widely use all around the globe. Most of us also facing many problems during the use of word press.

Word press cover so many websites that presents on internet. The most common error or difficulty the people face who are using word press is that these can not connect to data base. If this is happened to you while using word press and this happens to you so you do not need to panic or stressed. You can remove this error so easily.

Why does this error occur?

Everyone wants to know why is this so? Why this error occurs? Everyone of you wants the direct solution of this error but we also have to know the background of this error so that we can remove this permanently. By the removal of this error permanently you can panic free. The installation of word press consists of number of files and you need all the files to work properly so we have to thanks wp-config.php file. This file wp-config.php located on the root directory that helps to connect the files on word press. Error occur when this file can not able to access the data base.

The wp-config.php file: 

This is the file having the different configuration related to word press. You should go to MySQL setting in order to know the root cause of this error. To access this, you should go to the setting of the host provider inside the file manager option and edit with code editor. For example, there are four fundamental parameters that are discussed below:

  • Name of the MySQL Database: Define(‘DB_NAME’,’xxxxxxxxxxxxx’);
  • Username of Database: Define(‘DB_USER’,’xxxxxxxxxxxxx’);
  • Counterclaim access to database: Define(‘DB_PASSWORD’,’xxxxxxxxxxxxx’);
  • Address of the server where database is located: Define(‘DB_HOST’,’localhost’);

These are the four parameters of the file.

Check MySQL data

Now you have to go to control panel that located in file manager where an icon displays MySQL option. Access this button.

  • Scroll down until you see the option Current Database.
  • Search the option of name the database.
  • Now you have to check that the same name in wp-config.php that is DB’,’NAME section.
  • Save the file.
  • Reload the page again.

In case after doing this the error still occur do this:

  • Again, scroll and search the option current users.
  • Check the data and make sure that its name is ‘DB,’USER’.
  • Again, save the file.
  • Reload the page of word press again.

Sometimes by doing both of the procedures the error does not remove we have to keep testing. Now you have to follow the following steps that remove the error.

  • The option change password is next to current users. You have to click this option of change password.
  • Choose a new password.
  • Write the same password in wp-config.php.
  • Save the password.
  • Reload the page of word press.

Check data in phpMy Admin

Now, we are going to explain the simple method that help you out from this error:

  • In the file manager option, the control panel option lies now click this option.
  • After clicking on control panel click the option phpMy Admin.
  • Display the database list on the left.
  • Now you will see some many tables start with xxxx__
  • Now go to wp-config.php and look the table $ table__prefix ‘xxxx___’;.
  • Save the file.
  • Reload the page of word press.

If doing all of this the error does not remove the only thing that is left behind that is the host keep changing location of yours. In most of the cases this is not usual. This thing happens only few times. You may do the procedures that describe that will hopefully help you to solve this error.

Check the Location of Data base:

Now this is the way you have to contact your host that is your hosting provider and ask that the address from where your data base is hosted and the host provide you the data in wp-config.php file. Now search (‘DB_HOST’,’Localhost’) and write the address where it says the local host.

These are the methods that helps you to remove this error that keeps on occurring while contacting the database to word press. 

Add a Comment

Your email address will not be published. Required fields are marked *