Created
February 20, 2014 06:32
-
-
Save anytizer/9108138 to your computer and use it in GitHub Desktop.
How to get size of mysql database?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- http://forums.mysql.com/read.php?108,201578,201578 | |
SELECT | |
table_schema "Data Base Name", | |
SUM( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", | |
SUM( data_free )/ 1024 / 1024 "Free Space in MB" | |
FROM information_schema.TABLES | |
GROUP BY table_schema; | |
SELECT table_schema "Data Base Name", SUM( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" | |
FROM information_schema.TABLES GROUP BY table_schema ; | |
-- http://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database | |
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 | |
ORDER BY `DB Size in MB` DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment