CoderZone.org

Category: >> mySQL >> Get MySQL Database Size Bookmark and Share

<< lastnext >>

Snippet Name: Get MySQL Database Size

Description: Useful shell commands for determining overall DB size.

Comment: (none)

Author: CoderZone
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"}'
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 7