1. 将需要包含表查询并放到临时表中:show tables;
2. 使用下面SQL生成删除不必要表的SQL:
select concat('drop table if exists `', a.table_name, '`;') from information_schema.tables a left join tmp.a tmp on a.table_name = tmp.name where a.table_schema = 'cook' and tmp.name is null
3. 执行2中生成的SQL