To start with. You can’t. Not directly, anyway. There is no “drop table prefix_%;”, so stop looking.
This seems to be the easiest workaround that we’ve found based on information shared here.
So here’s how we did it. For reference, anywhere a word or a phrase is wrapped in greater than / less than signs, that’s where you use your own <information>.
First you need to get into mySQL via ssh.
mysql -u <database-name> -p
Then key in your password to get to the mysql command prompt, and make sure you’re looking at the right tables by using:
Once you’ve decided what your wildcard can be key this line in with your wildcard:
SELECT CONCAT( "DROP TABLE ", GROUP_CONCAT(TABLE_NAME) ) AS stmt FROM information_schema.TABLES WHERE TABLE_NAME LIKE "<wildcard>%";
Assuming your wildcard hits something, this will generate a string that will look similar to this:
DROP TABLE mucvkd_wp_ebay_store_categories,mucvkd_wp_woocommerce_tax_rate_locations,mucvkd_wp_ebay_jobs,mucvkd_wp_mailchimp_jobs,mucvkd_wp_wfconfig,mucvkd_wp_wftrafficrates,mucvkd_wp_wflivetraffichuman
Copy and paste that code right back into mysql, and most importantly, add a semi-colon at the end.
DROP TABLE mucvkd_wp_ebay_store_categories,mucvkd_wp_woocommerce_tax_rate_locations,mucvkd_wp_ebay_jobs,mucvkd_wp_mailchimp_jobs,mucvkd_wp_wfconfig,mucvkd_wp_wftrafficrates,mucvkd_wp_wflivetraffichuman;
And voilà, your tables are gone.
Generally a tool my phpMyAdmin would be a much faster solution to dropping multiple tables, but when you’ve got a database with thousands of spurious tables, those types of applications will usually choke when trying to display, select, and delete that many tables.