September 2021

MySQL database sizes

Submitted by admin on Thu, 09/23/2021 - 10:11

I'm going to forget this, so blogging it for the future.

SELECT
    table_schema AS 'Database',
    ROUND(SUM(data_length) / 1024 / 1024, 2) AS 'Data',
    ROUND(SUM(index_length) / 1024 / 1024, 2) AS 'Indexes',
    ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'Total'
FROM
    information_schema.TABLES
GROUP BY table_schema;