查看 MySQL 数据库中每个表占用的空间大小
1、进去指定schema 数据库(存放了其他的数据库的信息)
1 |
mysql> use information_schema; |
2、查询所有数据的大小
1 |
mysql> select concat(round( sum (DATA_LENGTH/1024/1024), 2), 'MB' ) |
2 |
-> as data from TABLES; |
8 |
1 row in set (16.81 sec) | 3、查看指定数据库实例的大小,比如说数据库 forexpert
1 |
mysql> select concat(round( sum (DATA_LENGTH/1024/1024), 2), 'MB' ) |
2 |
-> as data from TABLES where table_schema= 'forexpert' ; |
8 |
1 row in set (7.47 sec) | 4、查看指定数据库的表的大小,比如说数据库 forexpert 中的 member 表
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' ; |
9 |
1 row in set (1.88 sec) |
|