MySQL-CommandsQueries
From DevRandom
Sum of all index and data length in a database.
mysql DBNAME -e "show table status like '%'\G;" |egrep 'Index_length|Data_length' \
|awk -F: '{gsub (/ */, "", $2) ; tot += $2; } END {print "Total= " tot}'
Do the same with all databases
for d in `mysql -e "show databases\G" | grep "Database" |awk '{ gsub (/ */, "", $2) ; print $2}'`; do echo -n $d ;\
mysql $d -e "show table status like '%'\G;" |egrep 'Index_length|Data_length' | \
awk -F: '{gsub (/ */, "", $2) ; tot += $2; } END {print "= " tot}' ; done






