Get disk usage information for MySQL databases

Ever wonder how much space your MySQL database uses? Here you go:

SELECT table_schema "Database",
SUM( data_length + index_length ) / 1024 / 1024 "MB used",
SUM( data_free ) / 1024 / 1024 "MB free"
FROM information_schema.TABLES
GROUP BY table_schema;

Leave a Reply

%d bloggers like this: