Grab Your Free 17-Point WordPress Pre-Launch PDF Checklist:
Grab your free 10-Point WP Security Checklist:
Error establishing database connection is a very common error that I bet every WordPress user has encountered at some point. Luckily the fix is very easy and there are two ways to fix it.
Nearly every time this error is caused by incorrect or incomplete database information in your wp-config.php file or no linking the database user to the database.
Let’s tackle the first one first.
Incorrect or incomplete database information in your wp-config.php
All you have to do here is double check your MySQL database name, database username and the database user password. Make sure the credentials you have in the wp-config.php match exactly to the ones you created.
If you’re not sure where to find the ones you created, log into your cPanel account.
Then click on MySQL databases. That will show you all the database in your hosting account. Find the correct on for the wp-config.php file you’re working on. Make sure the db name matches what’s in the file.
Then find the db username you have linked to that database and what’s in the wp-config.php file matches exactly what’s associated with your database.
If you don’t remember the password, or have it noted somewhere, you can generated a new password for the user and put that into the wp-config.php.
While you’re here, you can make sure that the second possible reason for the error is taken care of.
At the bottom of the MySQL database page you will be able to link the database user to the database. Make sure they are linked and the correct privileges are set. If you’re unsure of the proper privileges, choose them all.
Now save the db user to database association. Save the wp-config.php file you were updating.
Then go to the page that was generating the error establishing database connection error and reload that page. Everything should be working normally now.
I hope this information helps you! If you have any questions leave a comment below or ping me @WPLearningLab on Twitter.
If you want more excellent WordPress information check out our website where we post WordPress tutorials daily.
Connect with us:
WP Learning Lab Channel: