The Problem
Instead of loading the website, one of my client sites is loading an error: “Error establishing a database connection.” When I go to the wp-admin page, instead of a login page it shows the error: “One or more database tables are unavailable. The database may need to be repaired.” When I click on “repaired”, it offers a resolution: “To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php
file. Once this line is added to your config, reload this page. define('WP_ALLOW_REPAIR', true);"
The Journey to the Fix
After googling the legitimacy of the problem, I found that wpbeginner has an article that covers this exact topic. Starting at the beginning, I modified the wp-config.php
file by adding the line define('WP_ALLOW_REPAIR', true);
. I then ran the database repair module and most of the database tables were okay except for the wpsf_options
table.
“It reported the following error: Table is marked as crashed.
WordPress will attempt to repair this table…
Failed to repair the wpsf_options table. Error: Table is marked as crashed”
Instead of continuing with the article’s instructions, I followed a hunch based off of the Database Repair report: I logged back into the cpanel and explored the specific database table. I then googled the error I received (above) and found a WordPress Forum answer.
Within MyPHPAdmin, I found the effected table and hit “Repair Table”. I then reran the database repair module and every table was found to be okay and optimized.
I then removed the “allow repair” code line from the wp-config.php
file and tested the wp-admin.php login page.
Tools/Skills Used: Internet Research/Google, MyPHPAdmin, Cpanel, FTP
Do you have a WordPress problem?
If venturing into the deep parts of your website is intimidating, don’t hesitate to contact me. There are two ways I can help you: I can do it for you OR I can teach you how to do it. Either way, it resolves your WordPress problem faster.