MySQL Database Table Stats
Do you manage thousands of databases? I do. One of the really big challenges for me was to be able to report disk usage by table/db/data file/index so I whipped up this handy dandy ruby script to do it for me. My requirements were that it output to the command line and to a log file. Clearly the script needs access to an account that has SELECT privileges on all of the databases you want to report on. The command example can be seen through the “–help” flag. But it is fairly straight forward. Here is a screenshot of the results:

Essentially the script logs into your mysql server and does a “SHOW DATABASES” and then iterates through each. For each database listed it will run a show table status and then calculate the data and index space for you and display the itemized and aggregate data in an easy to read format. Please send me any questions you might have.
The script can be found here:
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
September 22nd, 2007 at 5:41 pm
Heh. Clever perhaps, but I prefer Excel.
Kthanksbye.
October 10th, 2008 at 3:19 am
Sad ! The script link is broken :-/
October 10th, 2008 at 12:27 pm
Wow, I just took it down too. It is a bit dated and really single purpose but I am working on a new project to get this data and more. You can follow it at:
http://projects.splitbit.com/projects/show/rbmysqladmin
Should have the functionality you are looking for very soon.
-Daniel
June 11th, 2010 at 7:54 pm
Yeah sorry about that. I am going to be publishing a full toolset in ruby for mysql. I first need to recover from back surgery.