This article outlines the process of determining the size of a MySQL database and assessing the available free space within it.
Determine the database size:
Execute the following MySQL query to showcase the database name and its size in megabytes:
1 2 3 4 | SELECT table_schema "DataBase" , sum ( data_length + index_length ) / 1024 / 1024 "DataBase Size in MB" FROM information_schema.TABLES GROUP BY table_schema ; |
Determine the amount of available space:
Execute the subsequent query to observe the available free space in megabytes for a MySQL database.
1 2 3 4 5 | SELECT table_schema "DataBase" , sum ( data_length + index_length ) / 1024 / 1024 "DataBase Size in MB" , sum ( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema ; |
Hope it worked !!