1、进去指定schema 数据库(存放了其他的数据库的信息)
2、查询所有数据的大小
3、查看指定数据库实例的大小,比如说数据库 forexpert
4、查看指定数据库的表的大小,比如说数据库 forexpert 中的 member 表
1 | mysql> use information_schema; |
2 | Database changed |
1 | mysql> select concat(round( sum (DATA_LENGTH/1024/1024), 2), 'MB' ) |
2 | -> as data from TABLES; |
3 | + -----------+ |
4 | | data | |
5 | + -----------+ |
6 | | 6674.48MB | |
7 | + -----------+ |
8 | 1 row in set (16.81 sec) |
1 | mysql> select concat(round( sum (DATA_LENGTH/1024/1024), 2), 'MB' ) |
2 | -> as data from TABLES where table_schema= 'forexpert' ; |
3 | + -----------+ |
4 | | data | |
5 | + -----------+ |
6 | | 6542.30MB | |
7 | + -----------+ |
8 | 1 row in set (7.47 sec) |
1 | mysql> select concat(round( sum (DATA_LENGTH/1024/1024),2), 'MB' ) as data |
2 | -> from TABLES where table_schema= 'forexpert' |
3 | -> and table_name= 'member' ; |
4 | + --------+ |
5 | | data | |
6 | + --------+ |
7 | | 2.52MB | |
8 | + --------+ |
9 | 1 row in set (1.88 sec) |