Skip to content

Instantly share code, notes, and snippets.

@arktisklada
Last active July 25, 2019 21:14
Show Gist options
  • Save arktisklada/02f87035e052e690bfde to your computer and use it in GitHub Desktop.
Save arktisklada/02f87035e052e690bfde to your computer and use it in GitHub Desktop.
Various mysql database commands
/* database size */
SELECT table_schema "table_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;
/* size of all tables */
SELECT table_name AS Tables,
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "table_name";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment