select
table_schema "DATABASE",
convert(sum(data_length+index_length)/1048576,decimal(6,2)) "SIZE (MB)"
from
information_schema.tables
where
table_schema!="information_schema"
group by
table_schema;
SELECT table_schema "Base de datos",
ROUND(SUM(data_length+index_length)/1024/1024,3) "Tamaño (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
/*espacio libre para optimize */
SELECT table_schema "Base de datos",
sum( data_length + index_length ) / 1024 / 1024 "Tamaño (MB)",
sum( data_free )/ 1024 / 1024 "Espacio libre (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
SELECT TABLE_SCHEMA,TABLE_NAME
FROM TABLES WHERE TABLE_SCHEMA NOT IN ("information_schema","mysql") AND
Data_free > 0;