mysql 查询数据库容量
时间: 2023-10-17 07:36:15 浏览: 183
要查询MySQL数据库的容量,可以使用以下SQL查询语句:
```sql
select table_schema as '数据库', sum(data_length + index_length) / 1024 / 1024 as '总容量(MB)'
from information_schema.tables
group by table_schema;
```
这个查询语句将返回每个数据库的总容量(以MB为单位)。通过将结果按照数据库进行分组并求和每个数据库中所有表的数据长度和索引长度,我们可以得到每个数据库的总容量。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [常用mysql数据库配置文件](https://download.csdn.net/download/zslsh44/88278582)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [MySQL查看数据库表容量大小](https://blog.csdn.net/aan5071/article/details/101651151)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文