Digital Marketing

Check MySQL databases size

 To determine the sizes of all of your databases, at the mysql> prompt type the following command:

SELECT table_schema AS "Database",

ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"

FROM information_schema.TABLES

GROUP BY table_schema;

To determine the sizes of all of the tables in a specific database, at the mysql> prompt, type the following command. Replace database_name with the name of the database that you want to check:

SELECT table_name AS "Table",

ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"

FROM information_schema.TABLES

WHERE table_schema = "database_name"

ORDER BY (data_length + index_length) DESC;


Popular posts from this blog