Pages

Tuesday, June 26, 2012

How to check how much free space we have in Mysql database

fire the query
show table status like 'org';

The last column Comments gives the size of the database.


If you need to have a shell script to check InnoDB_free space of Mysql database here is the code


Query="show table status like 'org';"
#freespace=${echo "$Query" | mysql -t --host=tiber4 mvc | /bin/awk '/InnoDB free:/ {print $38}' }
freespace=$(echo "$Query" | mysql -t --host=$host $db | /bin/awk '/InnoDB free:/ {print $38}' )

echo $host has $freespace kB free

No comments:

Post a Comment