How do I check memory used by each database/tables in mysql using command prompt?

Viewed 10100

I've two or more databases in my mysql server. Total memory used by the databases are around 14GB. I want to know, memory used by each database and their tables.

4 Answers

Use this below query to to verify all the tables data size in MB from single database

SELECT
  TABLE_NAME AS `Table`,
  ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
  information_schema.TABLES
WHERE
  TABLE_SCHEMA = "yourDatabaseName"
ORDER BY
  (DATA_LENGTH + INDEX_LENGTH)
DESC;
Related