失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > mysql获取配置文件信息 四种获取MySQL数据库配置文件加载顺序

mysql获取配置文件信息 四种获取MySQL数据库配置文件加载顺序

时间:2021-09-23 07:26:49

相关推荐

mysql获取配置文件信息 四种获取MySQL数据库配置文件加载顺序

简介

有时候帮人排查一下MySQL数据库问题的时候,用ps -ef查看MySQL数据库进程的时候,竟然不显示配置的相关信息。

如果想看MySQL数据库的配置,就会一头雾水,于是就特地整理了一下,4种查看当前MySQL数据库加载数据库配置文件的顺序方法。

查看配置文件顺序方法

1.方法一

通过ps -ef查看MySQL数据库进程,一般用二进制包方式启动数据库,会显示。

[mysql@192 ~]$ ps -ef|grep -i mysql

mysql 62843 1 0 Sep05 ? 00:00:00 /bin/sh /u02/mysql/bin/mysqld_safe --defaults-file=/u02/conf/f

mysql 63855 62843 0 Sep05 ? 00:01:50 /u02/mysql/bin/mysqld --defaults-file=/u02/conf/f --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 f

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

/etc/f /etc/mysql/f /usr/local/mysql/etc/f ~/.f

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/f /etc/f ~/.f

4.方法四

通过mysql命令的帮助信息,可以获取当前MySQL数据库版本加载配置文件顺序

[mysql@192 ~]$ /u02/mysql/bin/mysql --help|grep 'f'

order of preference, f, $MYSQL_TCP_PORT, built-in

/etc/mysql/f /etc/f ~/.f

以上就是四种获取MySQL数据库加载配置文件顺序的方法,有些时候还是非常的有用。

如果觉得《mysql获取配置文件信息 四种获取MySQL数据库配置文件加载顺序》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。