简介
有时候帮人排查一下MySQL数据库问题的时候,用ps -ef查看MySQL数据库进程的时候,竟然不显示配置的相关信息。
如果想看MySQL数据库的配置,就会一头雾水,于是就特地整理了一下,4种查看当前MySQL数据库加载数据库配置文件的顺序方法。
查看配置文件顺序方法
1.方法一
通过ps -ef查看MySQL数据库进程,一般用二进制包方式启动数据库,会显示。
[mysql@192 ~]$ ps -ef|grep -i mysqlmysql 62843 1 0 Sep05 ? 00:00:00 bin/sh u02/mysql/bin/mysqld_safe --defaults-file=/u02/conf/my3308.cnfmysql 63855 62843 0 Sep05 ? 00:01:50 u02/mysql/bin/mysqld --defaults-file=/u02/conf/my3308.cnf --basedir=/u02/mysql --datadir=/u02/data/3308 --plugin-dir=/u02/mysql/lib/plugin --log-error=/u02/log/3308/error.log --open-files-limit=65535 --pid-file=/u02/run/3308/mysqld.pid --socket=/u02/run/3308/mysql.sock --port=3308
复制
2.方法二
通过my_print_defaults命令的帮助信息,可以获取当前MySQL数据库版本加载配置文件顺序
[mysql@192 ~]$ my_print_defaults --help|grep -A2 -B2 my.cnfDefault 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)
复制
3.方法三
通过mysqld命令的帮助信息,可以获取当前MySQL数据库版本加载配置文件顺序
[mysql@192 ~]$ u02/mysql/bin/mysqld --verbose --help|grep -A 1 'Default options'mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2 - No such file or directory)
Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf复制
4.方法四
通过mysql命令的帮助信息,可以获取当前MySQL数据库版本加载配置文件顺序
[mysql@192 ~]$ /u02/mysql/bin/mysql --help|grep 'my.cnf'
order of preference, my.cnf, $MYSQL_TCP_PORT, built-in
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf复制
以上就是四种获取MySQL数据库加载配置文件顺序的方法,有些时候还是非常的有用。
文章转载自落叶说Mysql数据库运维,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【专家有话说第五期】在不同年龄段,DBA应该怎样规划自己的职业发展?
墨天轮编辑部
1483次阅读
2025-03-13 11:40:53
MySQL8.0统计信息总结
闫建(Rock Yan)
550次阅读
2025-03-17 16:04:03
2月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
504次阅读
2025-03-13 14:38:19
SQL优化 - explain查看SQL执行计划(一)
金同学
441次阅读
2025-03-13 16:04:22
MySQL突然崩溃?教你用gdb解剖core文件,快速锁定“元凶”!
szrsu
429次阅读
2025-03-13 00:29:43
MySQL生产实战优化(利用Index skip scan优化性能提升257倍)
chengang
371次阅读
2025-03-17 10:36:40
MySQL数据库当前和历史事务分析
听见风的声音
346次阅读
2025-04-01 08:47:17
墨天轮个人数说知识点合集
JiekeXu
324次阅读
2025-04-01 15:56:03
MySQL 生产实践-Update 二级索引导致的性能问题排查
chengang
317次阅读
2025-03-28 16:28:31
MySQL8.0直方图功能简介
Rock Yan
260次阅读
2025-03-21 15:30:53