How To Get Mysql Database Size In MB

In this Tutorial i will describe how to get database size in MB.Its very important script when you want list of all available database in mysql server with size in MB based on current logged-in user.


The data_length + index_length is equal to the total table size.

data_length – store the real data.
index_length – store the table index.
below is the SQL script to list out the entire databases size

SELECT table_schema "scg_insights_app", SUM( data_length + index_length) / 1024 / 1024
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema

Above code gives each database record from your MySQL scheme for the current logged in user.The size of database is sum of the data and index length to show a grand total.

The following two tabs change content below.
Hi, This is Parvez Alam from India. I am software developer with 6 years’ experience in web development. I have submitted articles on PHP, Mysql, Magento,CSS, HTML, jQuery, web designing and social API. You can subscribe to my blog via RSS/Twitter/Google plus and Facebook. parvez1487(at)gmail(dot)com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>