可以通过以下 SQL 查询来查看 MySQL 数据库的大小:
SELECT table_schema "Database",
SUM(data_length + index_length) / 1024 / 1024 "Size (MB)"
FROM information_schema.tables
GROUP BY table_schema;这个查询会列出每个数据库的大小(单位是 MB)。其中:
data_length 是表数据的大小。
index_length 是索引的大小。
table_schema 是数据库名。如果只想查询特定数据库的大小,可以加上 WHERE 语句,例如:
SELECT table_schema "Database",
SUM(data_length + index_length) / 1024 / 1024 "Size (MB)"
FROM information_schema.tables
WHERE table_schema = 'your_database_name'
GROUP BY table_schema;原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。