查看配置文件顺序方法
方法一
一般我们通过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/my3308.cnf
mysql 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
方法二
通过my_print_defaults命令的帮助信息,可以获取当前MySQL数据库版本加载配置文件顺序
[mysql@192 ~]$ 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)
方法三
通过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
方法四
通过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数据库加载配置文件顺序的方法,有些时候还是非常的有用。
了解前端培训开发技术知识,关注我,有更多精彩内容与您分享!