扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
mysql> SELECT a.schema_name db_name, -> IFNULL(ROUND((SUM(b.data_length)+SUM(b.index_length))/1024/1024,2),0.00) -> total_size_mb, -> IFNULL(ROUND(((SUM(b.data_length)+SUM(b.index_length))- -> SUM(b.data_free))/1024/1024,2),0.00) data_used_mb, -> IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00) data_free_mb, -> IFNULL(ROUND((((SUM(b.data_length)+SUM(b.index_length))-SUM(b.data_free))/ -> ((SUM(b.data_length)+SUM(b.index_length)))*100),2),0) pct_used, -> COUNT(table_name) tables -> FROM information_schema.schemata a -> LEFT JOIN information_schema.tables b ON a.schema_name = b.table_schema -> WHERE a.schema_name != 'information_schema' -> GROUP BY a.schema_name -> ORDER BY 1; +---------+---------------+--------------+--------------+----------+--------+ | db_name | total_size_mb | data_used_mb | data_free_mb | pct_used | tables | +---------+---------------+--------------+--------------+----------+--------+ | gim | 432.67 | 432.67 | 0.00 | 100.00 | 16 | | gim2 | 8.64 | 8.64 | 0.00 | 100.00 | 6 | | mysql | 0.33 | 0.33 | 0.00 | 99.69 | 18 | | test | 0.00 | 0.00 | 0.00 | 0.00 | 0 | | tpcc | 126.09 | 126.09 | 0.00 | 100.00 | 9 | +---------+---------------+--------------+--------------+----------+--------+注意上面的示例中,应该设为不查询字典数据库自身,通过where条件语句来实现。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者