No matter what the reason, there are a few ways you can fix your files or database.

Backup and Restore

The absolute easiest way to fix and broken file or database issue is to restore your site from a working backup of your site. If you don’t have a backup that you can restore, then there are other fixes that you can try.

Before you do give the other options a shot, you should backup your entire site. Even if it’s broken, things could still get worse so it’s better to have something rather than nothing at all.

Here’s a list of posts you can check out for details on backing up your site:

Once you have added the line mentioned above, you can visit the database repair page: http://your-site.com/wp-admin/maint/repair.php and if you have an SSL certificate installed, you would visit https://your-site.com/wp-admin/maint/repair.php.

Don’t forget to replace your-site.com with your actual domain.

Keep in mind that you don’t need to be logged in to view this page so when you’re done repairing your database, be sure to remove the line mentioned earlier. Otherwise, anyone could get to that page.

WordPress has a built-in tool to repair your database.

When you visit the link, you can choose to click the Repair Database button or you can optimize your database whilst you repair it by clicking the Repair and Optimize Database button.

Once the process is complete, your site should be all fixed up and ready to go.

If that doesn’t work, you can repair your database through phpMyAdmin.

After logging in, click on your database on the list to the left, then when your database tables load on the page, scroll down and click the Check All box. In the drop down box next to the check box, select Repair table.

You can repair your database in phpMyAdmin as well.

Your database tables are automatically repaired and your site should be functional again.

Repairing Broken, Missing or Corrupted Files

But what if it’s your files that are missing, corrupted or broken? You can fix them, too.

After uncompressing the ZIP file, you can transfer the new files to your site. Just be sure to leave your /wp-content/ directory untouched or you stand to loose all the media files and images you uploaded to your site.

You could also try this with the plugins and themes you have installed. The only difference is that instead of downloading a fresh copy of WordPress, you would download a new copy of your plugin and theme files.

If All Else Fails…

If you have tried these fixes, but you haven’t had any luck getting your site back up, you can try turning on the WordPress debugging mode. For details on how to do this, check out Debugging WordPress: How to Use WP_DEBUG.

You can also try checking your error logs to see if you can identify the issue and also send them to your host to look over and analyze. Look for a file called debug.log under your /wp-content/ folder.

If that doesn’t resolve the issue, it’s time to contact your host. It’s possible that there could be a server issue such as a misconfiguration or it could have malfunctioned. If this is the case, contacting your host and having them fix it is the only way you can resolve your issue.

Well, there is one other way, but it’s not for the faint of heart:

If you don’t have a backup and you’re okay with losing your site completely, you can start over and delete your site, then reinstall WordPress.

Wrapping Up

By now, your site should be running as good as new and you shouldn’t see anymore errors that point to a missing, corrupted or otherwise broken database or files.

To avoid the long process of fixing your site if this ever happens again, it’s recommended that you regularly backup your site.

Have you come across this issue before? Are you experiencing it right now? Were you able to get your site running again with these tips? Feel free to share your experience in the comments below. If you know of any other tips that I have missed, I want to know so type that into a comment below as well.

A copywriter, copy editor, web developer, consultant, course instructor for The Academy and founder of WP Pros(e), Jenni McKinnon has spent over 15 years developing websites and almost as long for WordPress. A self-described WordPress nerd, she enjoys watching The Simpsons and names her test sites after references from the show.

Get fresh WP updates directly to your inbox.

2 Responses

Very useful info; I’m appending these items to my “WordPress is Pitching a Fit” troubleshooting list! Have the folks at WPMU DEV considered adding a Troubleshooting category (I think a Category rather than a Tag is appropriate). Thanks!