WordPress: Fixing a Corrupted Database (re-installing a clean one)

– Make sure you have clean back ups of your DATABASE (I suggest more than 1)
(keep clean copies on your hard drive)
– If you do not have backups, then you SHOULD NOT use this method

This method assumes you have a sufficient understanding of WordPress files, and how to get into your MYSQL DATABASE datadase

for decent auto scheduled backups, I suggest the plugin WP-DBManager
(set it to backup your database in the “sql.gz” format (GZIP )
(you can set this under DATABASE–>DB OPTIONS (once plugin is installed)
– where it says:
Automatic Scheduling
(Automatic Backing Up Of DB) – set Gzip to YES

If unsure, about your backups, you can always create a BRAND NEW DATABASE or which you “import into” using the following method:


1– Login to YOUR ISP PROVIDER, go into the section that resembles MYSQL DATABASE

2– Find the corrupt database (should know the name of the database first (if more than one databases))
(is it fixable or corrupt)?
(if corrupt then move forward, if fixable then you only need to do a REPAIR)

3– Create a new USERNAME login (and password) (thru your MYSQL DATABASE section of ISP site)

4– Go into FTP files and update your WP-CONFIG.PHP with your new USERNAME and PASSWORD
(- also download your last working DATABASE to your hard drive (from the folder WP-CONTENT–>BACKUP-DB if using the plugin mentioned above)

5– Go into the new login for your Database, “CHECK ALL“, then choose “DROP” from the drop down
(this empties out the database back to zero) – SO BE CERTAIN THAT you have a backup saved somewhere first!

6– Grab your backed up DATABASE FILE (should be something like: 1356516987_-_d60773932.sql.gz)

Database backups: I get these from using the plugin ” WP-DBManager“, which is set to back up every day

7- Upload this directly to your database by using the IMPORT function in MYSQL DATABASE
(this will rewrite the files back into your empty database with your older non corrupt database files)
(be patient, as it might take a few minutes)

8– Now you should be able to go directly into your WordPress site
by typing in:

9– Does the site come up and re-populate like before?
If not, either something went wrong with the database, or your THEME files are corrupt as well, of which you should do a full reinstall
(to reinstate clean WordPress files)

If you are able to get in with no problems, I suggest doing 2 main things:
1- Go into DASHBOARD–>UPDATES, then click the REINSTALL on the “latest version of WordPress.”
(you should also update to the most current version at this time)
2- Go into SETTINGS–>PERMALINKS, click the SAVE CHANGES button
(this is necessary to refresh all your links, so that your directories are all connected again)

That’s it!

– after, I suggest locking down security measures, such as:
– changing login / password
– update your .htaccess file with security measures (or the ones you had in their previously, before REINSTALL)
– check your theme files, maybe overwrite thru FTP with your previous backed up ones
– Delete any theme files that you are not using (from the FTP)
(sometimes, these unused theme files contain back doors for Hackers to get in)

Related Posts Plugin for WordPress, Blogger...