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.