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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s