Home >Database >Mysql Tutorial >How do I determine the size of a specific MySQL database?

How do I determine the size of a specific MySQL database?

Linda Hamilton
Linda HamiltonOriginal
2024-11-27 00:30:11288browse

How do I determine the size of a specific MySQL database?

Determining MySQL Database Size

If you need to ascertain the size of a specific MySQL database, such as "v3," here's how you can proceed:

Database Size Query

To retrieve the size of the database, execute the following query:

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; 

This query was sourced from the MySQL forums and provides detailed instructions for its execution.

Explanation

The above query:

  • Retrieves the database name ("DB Name")
  • Calculates and displays the database size in megabytes ("DB Size in MB")
  • Does not reference specific database name, allowing you to apply it to any database, including "v3"

The above is the detailed content of How do I determine the size of a specific MySQL database?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn