SELECT ... FROM information_schema.TABLES 命令详解

统计各数据库占用的磁盘空间(MB)

命令语法

SELECT ... FROM information_schema.TABLES

统计各数据库占用的磁盘空间(MB)

示例

$ SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024,2) AS mb FROM information_schema.TABLES GROUP BY table_schema;

SELECT ... FROM information_schema.TABLES 用法说明

SELECT ... FROM information_schema.TABLES 是「数据库管理」分类下的常用命令,作用是:统计各数据库占用的磁盘空间(MB)。

典型用法如下:SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024,2) AS mb FROM information_schema.TABLES GROUP BY table_schema;。你可以复制到终端直接运行,或查看下方同组的相关命令。

常见问题解答

SELECT ... FROM information_schema.TABLES 是什么?
SELECT ... FROM information_schema.TABLES 用于统计各数据库占用的磁盘空间(MB),属于「数据库管理」相关命令。
SELECT ... FROM information_schema.TABLES 怎么用?
在终端执行 SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024,2) AS mb FROM information_schema.TABLES GROUP BY table_schema; 即可,具体参数请按实际环境调整。
还有哪些相关命令?
「数据库管理」分类下还有 13 条相关命令,见下方「相关命令」。