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.
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.
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:
- Manually in phpMyAdmin or
- 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.
This way i can safely delete any unwanted database tables from plugins which i have already deleted from my WordPress plugins directory.
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.
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