最简单的方式,直接查看全局的,如下所示:
mysql> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select concat(round(sum(DATA_LENGTH/1024/1024),2), 'MB') as data from TABLES;
+-----------+
| data |
+-----------+
| 5516.40MB |
+-----------+
1 row in set (0.16 sec)
mysql>如果只想查看Zabbix数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| zabbix |
+--------------------+
4 rows in set (0.00 sec)
mysql> select sum(DATA_LENGTH)+sum(INDEX_LENGTH) from information_schema.tables where table_schema='zabbix';
+------------------------------------+
| sum(DATA_LENGTH)+sum(INDEX_LENGTH) |
+------------------------------------+
| 9501360128 |
+------------------------------------+
1 row in set (0.09 sec)
mysql> select concat(round(sum(DATA_LENGTH)/1024/1024+sum(INDEX_LENGTH)/1024/1024),'M') from information_schema.tables where table_schema='zabbix';
+---------------------------------------------------------------------------+
| concat(round(sum(DATA_LENGTH)/1024/1024+sum(INDEX_LENGTH)/1024/1024),'M') |
+---------------------------------------------------------------------------+
| 9063M |
+---------------------------------------------------------------------------+
1 row in set (0.10 sec)
mysq>
如果觉得《查询mysql存储数据大小_MySQL如何查询数据占用存储空间的大小?》对你有帮助,请点赞、收藏,并留下你的观点哦!