Error Establishing a Database Connection in WordPress

WordPress database repair
Eek! received an email that Google couldn’t get to my robot.txt file, checked the WordPress part of the site, to find the error: Error Establishing a Database Connection.

I was preparing to hunker down for the afternoon to find a solution, but the first result from DuckDuckGo pretty much solved it for me πŸ™‚

From Beginner’s guide to WordPress: How to Fix the Error Establishing a Database Connection in WordPress

The database may need to be repaired”, then you need to repair your database.

You can do this by adding the following line in your wp-config.php file:

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

Everything checked out OK, except for the one problem table: wp_options: Table is marked as crashed and last repair failed

My suspicions were confirmed, plugin problems! πŸ˜‰
I’ve been through the exercise of deactivating / activating plugins in the past, it’s timely and tiresome. This time I found a much quicker simpler solution, from the WordPress Codex

Reset your plugins folder via FTP or the file manager provided in your host’s control panel.

  • Via FTP or your host’s file manager, navigate to the wp-contents folder (directory
  • Via FTP or your host’s file manager, rename the folder “plugins” to “plugins.hold
  • Login to your WordPress administration menus (/wp-admin)
  • Via FTP or your host’s file manager, rename “plugins.hold” back to “plugins”

Sorted πŸ˜€
A task I thought that would take hours to fix, resolved in less than 5 mins

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.