Drop MySql databases wich dosnt have any table

graphic easy to install

If you did a bulk import, or when you receive error in middle of importing large sql. mostly there will be empty schemas in mysql(maria too) so now you can select all tables’s distincts schema’s name. then remove all schemas with tables from all schemas. tada!

actually no one will need it but, every 2 week i found myself in typing this script. so i paste it here to for my next usages. ^^

select Concat('Drop SCHEMA ',x.SCHEMA_NAME,';') 
from `information_schema`.SCHEMATA as x
where x.schema_name not in ( SELECT DISTINCT(b.TABLE_SCHEMA) 
                               FROM `information_schema`.`TABLES` as b )
CentiSOFT

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

This site uses Akismet to reduce spam. Learn how your comment data is processed.