Script to List Database Disk Usage in Plesk

Script to list database disk usage
This article will help you to list all MySQL databases available in a Plesk server with the disk usage using script.

I recently used a script to list all MySQL databases available in a Plesk server with the disk usage. You can find the script below.

 

Script to List Database Disk Usage in Plesk

if [ -d /var/lib/mysql ]; then echo -ne "nn=== MySQL DATABASES ===n"; mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "SELECT round(sum( data_length + index_length )/1024/1024,0) 'SM', table_schema 'DN' FROM information_schema.TABLES GROUP BY table_schema ORDER BY SM DESC G;" | sed '/***/d' | sed 's/SM: //' | sed ':a;N;$!ba;s/nDN:/Mt/g'; fi;

=== MySQL DATABASES === 
128M wordpress_123
99M joomla_db
6M psa 
1M mysql
1M sitebuilder3
1M apsc
0M phpmyadmin_o_4xzIaYJJqD
0M information_schema
0M phpmyadmin_0K_TUOFIGdTW
0M sitebuilder5
0M horde
0M atmail

 

Fell free to modify.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

Plesk Management Services

Focus on your business, and let us take care of your Plesk Servers!
From what you are reading, it seems you are interested in Plesk and related technologies. If you have a moment to spare, please take a look at our Plesk Server Management Services plan, and which might interest you even more!
Plesk Server Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

Introducing - WPHealers!

Complete WordPress Management, 24x7 Support & White Label Agency Plans!

WordPress migration service, security, white-label reseller services and lot more! Grab the introductory deals now!

WPHealers

ServerHealers uses cookies.