Fix “Error Establishing a Database Connection”
How to Fix the Error Establishing a Database Connection :
If you have been surfing the web for a while, you have at least seen this error a few times.
Error Establishing a Database Connection is one of those curses that could be caused by many reasons.
As a WordPress beginner, this could be awfully frustrating specially when it happened on its own without you changing anything.
Note: Before you make any database changes, make sure you have backup of your database file and WP-config.PHP file.
Please follow the below steps :
1 Log in to cPanel
2 Go to the WordPress directory and then click on WP-config.php.
3 As I mentioned, WordPress uses a specific username and password to connect to the database which looks like :
4 Make sure username and password must match with the credentials you created in MySQL Database in cPanel.
Once the username and password will same in wp-config.php script and MySQL Database section in cpanel Error will resolve.
Some More Solutions easy one to check if still you face the issue ;
1 Go to MySQL database Option in Cpanel and then choose the database and click on Repair Database.
2 You can also rename the plugin and theme folder if the issue continues.
3 Final Solution download the wp-config.php from the WordPress site which is mentioned below and update the username password and database name .
Download WordPress default files :
Thanks for watching this video