Thi*_*key 41
您可以通过运行找到所需的信息
mysql --help
Run Code Online (Sandbox Code Playgroud)
要么
mysqld --help --verbose
Run Code Online (Sandbox Code Playgroud)
我试过这个:
mysql --help | grep Default -A 1
Run Code Online (Sandbox Code Playgroud)
并输出:
(Defaults to on; use --skip-auto-rehash to disable.)
-A, --no-auto-rehash
--
(Defaults to on; use --skip-line-numbers to disable.)
-L, --skip-line-numbers
--
(Defaults to on; use --skip-column-names to disable.)
-N, --skip-column-names
--
(Defaults to on; use --skip-reconnect to disable.)
-s, --silent Be more silent. Print results with a tab as separator,
--
--default-auth=name Default authentication client-side plugin to use.
--binary-mode By default, ASCII '\0' is disallowed and '\r\n' is
--
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
Run Code Online (Sandbox Code Playgroud)
他们似乎都是不错的候选人:
/etc/my.cnf
/etc/mysql/my.cnf
/var/lib/mysql/my.cnf
...
Run Code Online (Sandbox Code Playgroud)
在许多情况下,您可以简单地使用 ps 检查系统进程列表:
server ~ # ps ax | grep '[m]ysqld'
Run Code Online (Sandbox Code Playgroud)
输出
10801 ? Ssl 0:27 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock
Run Code Online (Sandbox Code Playgroud)
或者
which mysqld
/usr/sbin/mysqld
Run Code Online (Sandbox Code Playgroud)
然后
/usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
/etc/mysql/my.cnf ~/.my.cnf /usr/etc/my.cnf
Run Code Online (Sandbox Code Playgroud)
小智 5
以给定顺序从以下文件中读取默认选项:
/etc/mysql/my.cnf
/etc/my.cnf
~/.my.cnf
Run Code Online (Sandbox Code Playgroud)