How to find the size of a mysql database

I get this question all the time.

“How big is my mysql database?!”

It’s not always an easy answer, but this little bash foo seems to take care of it.

mysql -uusername -ppassword database -e 'show table status;' | \
awk '{sum=sum+$7+$9;} END {print sum/1024/1024}'

Gives you the database size in mb.

:)



0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image

|

This work is licensed under a Creative Commons License | © doing.nothing.net.nz