MYSQL my_print_defaults程序解析
2015-11-05 15:43
645 查看
my_print_defaults 这个程序是用来解析my.cnf文件的,将其中的参数打印到终端。这个小程序在mysql的启动脚本中会有用到。
其读取my.cnf的顺序,从下面可以看出
按照读取顺序,其后的参数文件参数值可以覆盖前面的参数文件中的参数值。(即其后配置文件的优先级更高)
需要注意的是,这个程序可以用-e参数来添加附加参数文件,附加参数文件中的参数,优先级最高。
下面做个实验
其读取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中的参数是最后解析的。其值会覆盖掉前面的值
相关文章推荐
- mysql外链接查询
- mysql 重置 root 密码
- mysql 二进制日志恢复
- mysql 历史数据表迁移方案
- 转 mysql中int、bigint、smallint 和 tinyint的区别与长度的含义
- MySQL简单安全管理和故障排查
- Mysql 查询实现成绩排名,相同分数名次相同,类似于rank()函数
- mysql多表查询二内链接
- MySQLi实现数据库操作的预处理
- 一、源码安装mysql5.6-单实例
- MySQL配置文件my.cnf中各【】块解释
- mysqlbinlog使用
- 配置mysql日志输出
- mysql emoji表情支持
- mysql表查询一
- mysql数据库同表复制处理
- mysql远程导入导出数据库
- MySQL引擎: InnoDB 还是 MyISAM?
- MySQL创建方法错误:This function has none of DETERMINISTIC, NO SQL
- 关于Navicat和MYSQL字符集不统一出现的中文乱码问题