Cleaning out unused tables in your WordPress Blog

Today I moved my database from a MySQL 4 database server to a MySQL 5 database server, for no reason other than to move to 5. But I found a ton of tables in my database for various plugins that I knew I was no longer using. In fact, I had disabled ALL plugins shortly before this move.  I wanted to go in and delete all tables except those absolutely required for a base wordpress install.

To do the clean up I used two things:

  • a plugin called CleanOptions for WordPress
  • a MySQL database client

Before the cleanup

Here’s what my tables looked like before:




After the cleanup here’s what was left


Here’s how I did it.

Step 1 backup your database (you never know)

Step 2 remove database tables I no longer require

By working off the Database Description in the WordPress Codex I was able to identify what tables were absolutely required by WordPress in a default install. Since all plugins were deleted/disabled all other tables were not needed. So I nuked them.

Step 3 remove all options no longer required.

This involved installing and executing the Clean Options plugin and best I can tell it got everything.

Finally re-enable the plugins I required

The only plugins I kept after this clean up were Akismet, WP-SuperCache (I didn’t need to hack it to work, it just worked this time) and a lightbox plugin that I need to re-enable. I like to test out and install plugins so I had so much garbage in there over the past few years that I really needed to clean house. Well, the house is very clean now I also deleted more than 120 different themes I had tested over the years and only have the default themes and the one I’m currently using enabled now.

One Reply to “Cleaning out unused tables in your WordPress Blog”

Leave a Reply