Error establishing a database connection is most common error faced by WordPress user.Nobody loves their blog to encounter with this problem.How long our site is going to be in down is that much of traffic we are going to loss same as to revenue.
Read This: Free Keyword Research Tools
What is Error Establishing a Database Connection?
This error happens when PHP unable to connect your MySQL Databases to built your site.There are various reasons behind your site’s PHP code not connecting to your Database.
Why WordPress Error Establishing a Database Connection Occurs
Before going to know the reason behind this error let us know how WordPress works.Your WordPress site is built with two languages, PHP on the client side and MySQL Database on the server side.
MySQL Stores all the information like login details,post and page datas,plugin information etc.Your PHP code has other informations like wp-config.php,index.php etc.
When someone visits your site, PHP code is executed, and it fetches data from MySQL to build your site.If your PHP code is unable to get the data from MySQL “Error Establishing a Database Connection ” arises.
The Possible reason behind this is
- Incorrect Login credentials
- Corrupted Database
- Corrupted Files
- Errors from Hosting Company Side
Read This:Add Bigrock Custom Domain
Fix the Error Establishing a Database Connection in WordPress
Note: Don’t forget to take backup before fixing the errors
Before moving further check whether the same problems arise in both front-end(yoursite.com) and back-end(yoursite.com/wp-admin).
If both have same error(error establish a database connection) follow the second method.If you find this error(one or more database tables are unavailable)follow below method.
Repair the database
If you find this error “one or more database tables are unavailable” you need to repair your database.
To repair your database follow these simple steps
Open your wp-config.php file and add the below code on the bottom
Check wp-config file
In order to confirm whether your login credentials are correct you need to check the config file.
Open wp-config file
Check for below codes in the wp-config file.Confirm both of them are same
If you have any other problems in overcoming this error kindly inform us through the comment section.If you have any other solutions kindly tell us.Do share it with your friends
Get more stuff like this
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Thank you for subscribing.
Something went wrong.