mysql bin my_print_defaults.exe_MYSQL my_print_defaults程序解析

my_print_defaults 这个程序是用来解析my.cnf文件的,将其中的参数打印到终端。这个小程序在mysql的启动脚本中会有用到。

其读取my.cnf的顺序,从下面可以看出

[root@slave159 ~]# /opt/mysql-5.5.41/bin/my_print_defaults --help|grep -A2 -B2 my.cnf

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

Variables (--variable-name=value)

按照读取顺序,其后的参数文件参数值可以覆盖前面的参数文件中的参数值。(即其后配置文件的优先级更高)

需要注意的是,这个程序可以用-e参数来添加附加参数文件,附加参数文件中的参数,优先级最高。

下面做个实验

[root@slave159 ~]# /opt/mysql-5.5.41/bin/my_print_defaults mysqld server mysql_server mysql.server

--server-id=159

--log-bin=mysql-bin

--event_scheduler=1

--port=3306

--socket=/tmp/mysqltwo.sock

--skip-external-locking

--skip_name_resolve

--key_buffer_size=384M

--max_allowed_packet=5M

--table_open_cache=510

--sort_buffer_size=16M

--read_buffer_size=2M

--read_rnd_buffer_size=8M

--myisam_sort_buffer_size=64M

--thread_cache_size=8

--query_cache_size=0

--query_cache_type=OFF

--thread_concurrency=8

--character_set_server=utf8

--lower_case_table_names=1

--max_connections=500

--max_heap_table_size=256M

--log_bin=mysql-bin

--log_bin_trust_function_creators=1

--expire_logs_days=3

--tokudb_commit_sync=OFF

--tokudb_fsync_log_period=1000

--tokudb_row_format=tokudb_fast

--default_storage_engine=tokudb

--datadir=/u01/data_3307

--basedir=/opt/mysql-5.5.41

--user=mysql

--server-id=159

[root@slave159 ~]# /opt/mysql-5.5.41/bin/my_print_defaults -e /opt/mysql-5.5.41/my.cnf mysqld server mysql_server mysql.server

--server-id=159

--log-bin=mysql-bin

--event_scheduler=1

--port=3306

--socket=/tmp/mysqltwo.sock

--skip-external-locking

--skip_name_resolve

--key_buffer_size=384M

--max_allowed_packet=5M

--table_open_cache=510

--sort_buffer_size=16M

--read_buffer_size=2M

--read_rnd_buffer_size=8M

--myisam_sort_buffer_size=64M

--thread_cache_size=8

--query_cache_size=0

--query_cache_type=OFF

--thread_concurrency=8

--character_set_server=utf8

--lower_case_table_names=1

--max_connections=500

--max_heap_table_size=256M

--log_bin=mysql-bin

--log_bin_trust_function_creators=1

--expire_logs_days=3

--tokudb_commit_sync=OFF

--tokudb_fsync_log_period=1000

--tokudb_row_format=tokudb_fast

--default_storage_engine=tokudb

--datadir=/u01/data_3307

--basedir=/opt/mysql-5.5.41

--user=mysql

--server-id=159

--server-id=159

--log-bin=mysql-bin

--event_scheduler=1

--port=3306

--socket=/tmp/mysqltwo.sock

--skip-external-locking

--skip_name_resolve

--key_buffer_size=384M

--max_allowed_packet=5M

--table_open_cache=512

--sort_buffer_size=30M

--read_buffer_size=2M

--read_rnd_buffer_size=8M

--myisam_sort_buffer_size=64M

--thread_cache_size=8

--query_cache_size=0

--query_cache_type=OFF

--thread_concurrency=8

--character_set_server=utf8

--lower_case_table_names=1

--max_connections=500

--max_heap_table_size=256M

--log_bin=mysql-bin

--log_bin_trust_function_creators=1

--expire_logs_days=3

--tokudb_commit_sync=OFF

--tokudb_fsync_log_period=1000

--tokudb_row_format=tokudb_fast

--general_log=1

--default_storage_engine=tokudb

--datadir=/u02/data

--basedir=/opt/mysql-5.5.41

--user=mysql

--server-id=159

从上面实验可以看出,附加参数文件my.cnf中的参数是最后解析的。其值会覆盖掉前面的值

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值