Removing Database Tables After Deleting Unwanted Plugins

Delete Plugin Database TablesIf you’re a bit like me, you’ve probably installed hundreds of different plugins to test out.

Nowadays i use a demo site for testing but before this i used this sites installation.

I’ve noticed that even when you deactivate and then delete a plugin entirely, you’ll still find some tables for the plugin remaining in your database. Why?

When you delete a plugin it normally only deletes the plugin files from your plugins folder and not the database tables.

Here’s an example: Note the ‘Yes, delete these files’ text.

Delete Plugin Files

There’s normally no mention of deleting and removing the database tables created in your MySQL database when you install a plugin for the first time.

You can easily view your plugin tables using phpMyAdmin which you can access by going to your web hosts cPanel > Databases > phpMyAdmin and selecting the database from the left hand sidebar for your WordPress installation.

Databases

I like to run my database as efficiently as possible and run a database optimization plugin every week to remove unwanted post revisions.

Your can delete unwanted plugin tables in your database 2 ways:

  1. Manually in phpMyAdmin or
  2. Using a database plugin which offers the function to Drop/Empty database tables

Deleting Unwanted Plugin Database Tables in phpMyAdmin Manually

Example: Lets take a look at the database tables left behind on this site and compare it to the plugins i have active or inactive on this site.

Caution: Always create a backup of your database using the phpMyAdmin Export function or a database backup plugin before deleting database tables.

This way i can safely delete any unwanted database tables from plugins which i have already deleted from my WordPress plugins directory.

Deleted Plugin Database Tables

The above screenshot clearly shows several rows of database tables left behind after i have deleted the plugin WP Download Monitor.

This proves that your plugin database tables will be left behind even after you delete the plugin files in your WordPress Installed Plugins screen.

To delete these database tables manually, simply check the box next to the tables you wish to remove and click the Drop link next to the red button on the same row.

Deleting Unwanted Plugin Database Tables Using a Plugin

There’s a few database plugins which you can use to delete tables that you no longer need after deleting the plugin files.

WP Database Backup plugin offers a feature which will drop database tables.

The plugin will simply access phpMyAdmin and delete the tables which you select which is pretty much the same as deleting them manually in phpMyAdmin.

Here’s a screenshot below which shows you the option to either Empty or Drop tables.

WP DB Manager - Drop or Empty Database Tables

Once you install the WP DB Manager plugin, simply navigate to the Empty/Drop link in the plugin settings and check which tables you need to drop.

1. EMPTYING a table means all the rows in the table will be deleted. Backup Your Database First
2. DROPPING a table means deleting the table. Backup Your Database First

I tested both methods for deleting database tables left over after deleting unwanted plugins and these methods work fine.

I don’t think a plugin exists currently which will automatically remove plugin database tables when you delete a plugin.

Know of any? Please leave a link in the comments. Thanks


Comments

9 responses to “Removing Database Tables After Deleting Unwanted Plugins”

  1. […] Hiába inaktiválsz egy bővítményt, a weboldal adatbázisában attól még ott maradnak a fájlok, amelyek feleslegesen foglalják a helyet, ezzel befolyásolva a betöltődési sebességet is. A bővítmények eltávolításáról bővebben itt olvashatsz >> […]

  2. Phil Duncan Avatar
    Phil Duncan

    You might also checkout this plugin to help with this task:

    https://wordpress.org/plugins/plugins-garbage-collector/

    It seemed to do a good job on our multisite network where we needed to locate no longer needed plugin tables in 60 plus sites.

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks Phil

  3. Only “WP-DBManager” had these features…

  4. I also noticed (at least a few) plugins also use the table wp_options to store some settings. You might want to check this table out as well!

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks for the tip Jonathan

    1. Brad Dalton Avatar
      Brad Dalton

      You’re welcome

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.