搬家后的博客链接: IT客栈 www.itkezhan.org
- //查看的MySQL自带管理库:information_schema
- //例如要查的数据库是:test
- //例如要查的表是test数据库中的bikes
- mysql> use information_schema;
- Database changed
- mysql> select data_length,index_length
- -> from tables where
- -> table_schema='test'
- -> and table_name = 'bikes';
- +----------------+------------------+
- | data_length | index_length |
- +----------------+------------------+
- | 166379520 | 235782144 |
- +----------------+------------------+
- 1 row in set (0.02 sec)
- mysql> select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB,
- -> concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB
- -> from tables where
- -> table_schema='test'
- -> and table_name = 'bikes';
- +-----------------------+------------------------+
- | data_length_MB | index_length_MB |
- +-----------------------+------------------------+
- | 158.67MB | 224.86MB |
- +-----------------------+------------------------+
- 1 row in set (0.03 sec)