Wednesday, June 4, 2014

Removing tables from database with a particular prefix

use the statement below to get a list of tables. you can then copy the statement and execute it. if there are alot of tables, you may have to repeat the process as often as needed. SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) AS statement FROM information_schema.tables WHERE table_schema = 'database_name' AND table_name LIKE 'myprefix_%'; replace 'database_name' with the name of your database and 'myprefix_' with the prefix that you want to delete.

No comments: