How to Fix Error Establishing a Database Connection in WordPress


Staff member
- If you encounter this error when trying to login to /wp-admin/ folder, then your database has been corrupted

“[B]One or more database tables are unavailable. The database may need to be repaired[/B]”

Then put following code in your wp-config.php file :
define('WP_ALLOW_REPAIR', true);

And then run following url in browser to repair and optimize your Wordpress Database.