Tuesday, July 31, 2012

MySQL: HOW TO GET THE DATABASE SIZE FROM THE MYSQL QUERY

Run the below query you can get the Data Base Size in MySQL. 
If you run the query which is given below in MySQL Query Browser then you will get the two columns first will display the Data Base Name and the second will display the Data Base Size in MB.

mysql# SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;


And if you want to know How to view the Free space available for my Data Base in MySQL?
Run the below query:


mysql# SELECT table_schema "Data Base 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 ;

.

0 comments:

Post a Comment