转自:http://www.oschina.net/question/12_3673
1、进去指定schema 数据库(存放了其他的数据库的信息)
mysql> use information_schema;
database changed
2、查询所有数据的大小
mysql> select concat(round(sum(data_length/1024/1024), 2), 'mb')
-> as data from tables;
+———–+
| data |
+———–+
| 6674.48mb |
+———–+
1 row in set (16.81 sec)?
3、查看指定数据库实例的大小,比如说数据库 forexpert
mysql> select concat(round(sum(data_length/1024/1024), 2), 'mb')
-> as data from tables where table_schema='forexpert';
+———–+
| data |
+———–+
| 6542.30mb |
+———–+
1 row in set (7.47 sec)
4、查看指定数据库的表的大小,比如说数据库 forexpert 中的 member 表 ?
mysql> select concat(round(sum(data_length/1024/1024),2),'mb') as data
-> from tables where table_schema='forexpert'
-> and table_name='member';
+——–+
| data |
+——–+
| 2.52mb |
+——–+
1 row in set (1.88 sec)
原文地址:mysql 查看数据库中每个表占用的空间大小, 感谢原作者分享。
