MySQL implements a method for quickly deleting all or part of tables without deleting the database

1. Take the mysql library that comes with mysql as an example:

--Delete all tables whose table name is mysql database, (export the query results with excle and put them in the database for execution)
SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='mysql';

--Delete all tables starting with help_ whose table name is mysql database (export the query results with excle and execute them in the database)
SELECT CONCAT('drop table ',t.`TABLE_NAME`,'; ') dropsql FROM information_schema.`TABLES` t WHERE t.`TABLE_NAME` LIKE 'help_%';

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325129644&siteId=291194637