mysql查看当前所有的数据库和索引大小

SELECT
    table_schema,
    concat(
        TRUNCATE (
            sum(data_length) / 1024 / 1024,
            2
        ),
        ' mb'
    ) AS data_size,
    concat(
        TRUNCATE (
            sum(index_length) / 1024 / 1024,
            2
        ),
        'mb'
    ) AS index_size
FROM
    information_schema. TABLES
#where table_schema = 'youdb'
GROUP BY table_schema ORDER BY data_length DESC;
古之善为士者,微妙玄通,深不可识
原文地址:https://www.cnblogs.com/xzhg/p/14842120.html