Snippet Name: Get MySQL Database Size
Description: Useful shell commands for determining overall DB size.
Comment: (none)
Language: MYSQL
Highlight Mode: MYSQL
Last Modified: March 01st, 2009
|
mysql -uroot -D db_development -e
"show table status\G"| egrep "(Index|Data)_length" |
awk 'BEGIN { rsum = 0 } { rsum += $2 } END { print rsum }'
-- another way:
echo "SELECT TABLE STATUS" | mysql-dbrc //DATABASE// |
awk '{sum=sum+$7+$9;}
END {print sum/1024/1024 "M"}'
|