LoginSignup
17
18

More than 5 years have passed since last update.

Bashワンライナーで、MySQLのSHOW STATUSからmy.cnfのパラメーター参考を生成する

Last updated at Posted at 2014-07-08

ワンライナーでMySQLのSHOW STATUSからmy.cnfのパラメーター参考を生成

sshシェルとか取れない環境などで、参考にコンフィグレーションファイルが欲しいとか思うことがあるわけです。
どういうわけか、つまりはAmazon RDSとかいうわけですが・・・。
まぁ、mysqlを結構使う人にとっては当たり前なのかもしれませんね。


mysql -u root -p -h 127.0.0.1 -A -NBe 'SHOW VARIABLES' | sed 's,\t,^=,' | column -ts^ | tr "\n" '@' | eval $(echo "sed '" "s,@\("{a..z}"\),\n\n\1,;" "'") | tr '@' "\n" | sed 's,^,,g'

Enter password: 
auto_increment_increment                                =1

auto_increment_offset                                   =1
autocommit                                              =ON
automatic_sp_privileges                                 =ON

back_log                                                =900
basedir                                                 =/rdsdbbin/mysql/
big_tables                                              =OFF
bind_address                                            =*
binlog_cache_size                                       =32768
binlog_checksum                                         =CRC32
binlog_direct_non_transactional_updates                 =OFF
binlog_format                                           =STATEMENT
binlog_max_flush_queue_time                             =0
binlog_order_commits                                    =ON
binlog_row_image                                        =FULL
binlog_rows_query_log_events                            =OFF
binlog_stmt_cache_size                                  =32768
block_encryption_mode                                   =aes-128-ecb
bulk_insert_buffer_size                                 =8388608

character_set_client                                    =utf8
character_set_connection                                =utf8
character_set_database                                  =latin1
character_set_filesystem                                =binary
character_set_results                                   =utf8
character_set_server                                    =latin1
character_set_system                                    =utf8
17
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
18