Today, there is only a very short article with an SQL statement which allows you to display the size of a MySQL database, as well as the description of how to read out the database size via phpMyAdmin. Let’s start with the SQL statement. To display the size of a particular MySQL database in MegaByte (MB), use the following SQL command:
SELECT table_schema, sum( data_length + index_length ) / 1024 / 1024 "Database Size in MB" FROM information_schema.TABLES WHERE table_schema="{my_database_name}" GROUP BY table_schema
However, within the statement, before the execution, the placeholder {my_database_name} must be replaced by the name of the database whose size is to be determined. If the size of all database should be displayed on the MySQL server, the where clause can be omitted. Thus the statement would look as follows:
SELECT table_schema, sum( data_length + index_length ) / 1024 / 1024 "Database Size in MB" FROM information_schema.TABLES GROUP BY table_schema
If you prefer a graphical solution instead of a statement, the database size can also be read directly in phpMyAdmin. To do so, click on the desired database in the left-hand menu tree (1). The database overview table contains a column named “Size” (2), which shows the size of the individual tables in the database. The cumulative column value (3), corresponds to the value “database size”, is then found at the end of the table overview.