Home » Useful » Checking size of mysql database

Checking size of mysql database

To access the MySQL on a server with Plesk use the following commands:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow`

Then to check the database size run:

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 ;

Displaying free space available for the databse in 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 ; 
Posted in Useful and tagged as , , , ,

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.