查看Mysql数据库有多大

 方法一:mysql

mysql>SELECT table_schema AS 'DBname', sql

Round( Sum( data_length + index_length ) / 1024 / 1024, 3 ) AS 'Db Size (MB)', 
Round( Sum( data_free ) / 1024 / 1024, 3 ) AS 'Free Space (MB)' 
FROM information_schema.tables GROUP BY table_schema ; ide

方法二:spa

 

./mysql -uroot -p'passwd' -D dbname -e "show table status\G"| egrep "(Index|Data)_length" | awk 'BEGIN { rsum = 0 } { rsum += $2 } END { print rsum/1024/1024 "MB" }'orm