查询数据库大小

SELECT table_schema "dbname",
    sum( data_length + index_length ) / 1024 / 1024 "size"
FROM information_schema.TABLES
GROUP BY table_schema  order by size desc;

查看单数据库所有数据表的内存情况

SELECT
    table_schema AS '数据库',
    table_name AS '表名',
    table_rows AS '记录数',
    TRUNCATE (data_length / 1024 / 1024, 2) AS '数据容量(MB)',
    TRUNCATE (index_length / 1024 / 1024, 2) AS '索引容量(MB)',
      TRUNCATE ((data_length+index_length) /1024/1024,2) as 'total'
FROM
    information_schema.TABLES
WHERE
    table_schema = 'huchi_ad_log' -- 数据库名字
ORDER BY
    total DESC;