[TRUCO MySQL] Encuentre el tamaño de todas las bases de datos en el servidor.
sql
DROP VIEW IF EXISTS dbsize; CREATE VIEW dbsize AS SELECT s.schema_name AS 'Schema', SUM(t.data_length) AS DATA, SUM( t.index_length ) AS Indexes, SUM(t.data_length) + SUM(t.index_length) AS 'Usado en Mb', IF(SUM(t.data_free)=0,'',SUM(t.data_free)) AS 'Libre en Mb', IF( SUM(t.data_free)=0, '', 100 * (SUM(t.data_length) + SUM(t.index_length)) / ((SUM(t.data_length)+SUM(t.index_length) + SUM(IFNULL(t.data_free,0))) ) ) AS '% Usado', COUNT(TABLE_NAME) AS TABLES FROM information_schema.schemata s LEFT JOIN information_schema.TABLES t ON s.schema_name = t.table_schema GROUP BY s.schema_name WITH ROLLUP
Saludos!