The mysqladmin command returns the values in bytes. I will like to see the value in MB if it is greater than 1 MB (1048576 bytes).
$ mysqladmin variables
+---------------------------------+----------------------------------+
| Variable_name | Value |
+---------------------------------+----------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
...
| interactive_timeout | 14400 |
| join_buffer_size | 10481664 |
| key_buffer_size | 1073741824 |
I can save and calculate each variable one at a time. But how do I show all the values in MB?
myval1=$(((`mysqladmin variables | grep '\<key_buffer_size\>' | awk '{print $4}'`)/1048576))