How To Fix Database Error In WordPress

SHARE

How to Fix the Error Establishing a Database Connection in WordPress Blog.
Error Establishing a Database Connection is one of those curses that could be caused by many reasons. As a beginner, this could be awfully frustrating specially when it happened on its own without you changing anything or when you didn’t edit any theme or plugin via your blog.

Why You’re getting this error?
In a notch shell, this error usually occurs because WordPress is unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In our experience, majority of the times this error happens because of some sort of server error however there could be other factors as well. Lets take a look at how to go about troubleshooting this problem.

How to Fix the Error
The only thing that can be done in other to fix this problem is to Repair The Database.

How to repair WordPress Database
You can do this by adding the following line in your wp-config.php file. Add it just before ‘That’s all, stop editing! Happy blogging’ line of the wp-config.php.

define('WP_ALLOW_REPAIR', true);

Once you have done that, you can see the settings by visiting this page: http://www.yoursite.com/wp-admin/maint/repair.php

Kindly Note that the user does not need to be logged in to access this functionality when this define is set. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.
If this repair did not fix the problem, or you are having trouble running the repair the you can get in touch with your web hoster.

LEAVE A REPLY

Please enter your comment!
Please enter your name here