Categories
Tips & Tricks

Solved – While Migration Establishing a Database Connection Problem

Error establishing a database connection

It is a very common problem of establishing a database connection while migrating your hosting to another hosting provider. 

Why does this problem happen?

  • If you have forgotten to upload wp-config.php file in public_html folder.
  • If you have made a new WordPress installation in another server and forgot to change the database name, database username, database password in the wp-config.php file. 

This error is all about the error in the wp-config.php file because this is the file that helps to connect WordPress with the database. 

How to solve this error?

Method 1 – Copy the existing wp-config.php file and paste it in the new hosting provider public_html folder. 

Method 2 – You can also copy the database name, database username, and database password details and put it into new wp-config.php.

  • Database username
  • Database password
  • Database name 

These 3 things are only necessary to put into the wp-config.php file to establish a database connection.

I hope you can solve your problem easily with the method. If any questions please ask, or if you solve your problem, please comment on me.