尝试做一些研究,结果总是
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
FROM TABLES WHERE table_schema='home';
Run Code Online (Sandbox Code Playgroud)
它显示已使用的总大小,是否有任何命令可以用来查看总磁盘空间(服务器的容量)?
小智 6
这个问题[大约四年前][1]已经得到了回答。
要总结答案,请运行以下命令:
mysql> select table_schema, sum((data_length+index_length)/1024/1024) AS MB from information_schema.tables group by 1;
+--------------------+-----------------+
| table_schema | MB |
+--------------------+-----------------+
| prod | 298025.72448921 |
| information_schema | 0.00781248 |
| maatkit | 70.77330779 |
| mysql | 0.66873168 |
| test | 4752.31449127 |
+--------------------+-----------------+
5 rows in set (0.01 sec)
Run Code Online (Sandbox Code Playgroud)
如果您有大量表,它可能会很慢,正如您已经发现的那样。
希望这有帮助。