Formatting mysqladmin variables output sensibly

OK, so if you’re here, you’ve probably been searching for a variable in mysqladmin and have watched twenty screens of spaces and pipes scroll past. Me too, so I’m just leaving this little snatch of formatting to remind myself how to tame it down to something readable. So if you’re searching for ‘buffer’ related variables, you’ll need something like this.

mysqladmin variables | tr -d " " | awk -F'|' '{print $2 " = " $3}' | grep buffer 

Which gives you

 aria_pagecache_buffer_size = 134217728
 aria_sort_buffer_size = 268434432
 bulk_insert_buffer_size = 16777216
 innodb_buffer_pool_chunk_size = 134217728
 innodb_buffer_pool_dump_at_shutdown = ON
 innodb_buffer_pool_dump_now = OFF
 innodb_buffer_pool_dump_pct = 25
 innodb_buffer_pool_filename = ib_buffer_pool
 innodb_buffer_pool_instances = 1
 innodb_buffer_pool_load_abort = OFF
 innodb_buffer_pool_load_at_startup = ON
 innodb_buffer_pool_load_now = OFF
 innodb_buffer_pool_size = 268435456
 innodb_change_buffer_max_size = 25
 innodb_change_buffering = all
 innodb_log_buffer_size = 8388608
 innodb_sort_buffer_size = 1048576
 join_buffer_size = 262144
 join_buffer_space_limit = 2097152
 key_buffer_size = 67108864
 mrr_buffer_size = 262144
 myisam_sort_buffer_size = 536870912
 net_buffer_length = 16384
 preload_buffer_size = 32768
 read_buffer_size = 2097152
 read_rnd_buffer_size = 1048576
 sort_buffer_size = 4194304
 sql_buffer_result = OFF

Alternatively, you might have some luck with


mysql -e "SHOW VARIABLES LIKE '%buffer%';"

Leave a Comment