Mysql’de Tüm Veritabanları ve Tablo Sayıları

here is How to list all databases and their table count on Mysql Server.

mysqlcheck -u root -p --auto-repair --check --all-databases
Repair all Mysql Table in all schemas

 

select TABLE_schema ,count(table_name) from information_schema.`TABLES` group by TABLE_schema
List Schemas and Tables

 

select concat('repair table ', table_name, ';') from information_schema.tables 
where table_schema='mydatabase';
Creating repair all tables script of selected database

Drop MySql databases wich dosnt have any table

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 )