如何获取mysql数据库的大小?

2021-11-20 00:00:00 database mysql

如何获取mysql数据库的大小?
假设目标数据库名为v3".

How to get size of a mysql database?
Suppose the target database is called "v3".

推荐答案

运行这个查询,你可能会得到你想要的:

Run this query and you'll probably get what you're looking for:

SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema; 

这个查询来自mysql论坛,那里有更多提供全面的说明.

This query comes from the mysql forums, where there are more comprehensive instructions available.

相关文章