Disk usage of mysql DB

To calculate the disk usage of your DBs in mysql

 

you can use “DU” which is less reliable and if you hosting on cloud database services, you cannot use this.

du -sh /var/lib/mysql/database

OR

use the below query.

 

select table_schema, sum((data_length+index_length)/1024/1024) AS MB from information_schema.tables group by 1;

Leave a Reply

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