日期:2014-05-16 浏览次数:20572 次
mysql> use information_schema Database changed mysql> select concat(round(sum(index_LENGTH)/(1024*1024),2),'MB') as 'Index Size' from tables where table_schema='bbs'; +-----------+ | Index Size | +-----------+ | 0.00MB | +-----------+ 1 row in set (0.01 sec) 解释: concat和“MB”是单位 round和2表明精确2位小数 sum表明所有的索引相加 table_schema='bbs' bbs就是你要统计的数据库 mysql> select concat(round(sum(data_LENGTH)/(1024*1024),2),'MB') as 'Data Size' from tables where table_schema='bbs'; +-----------+ | Data Size | +-----------+ | 4.34MB | +-----------+ 1 row in set (0.01 sec)