40

Redhat linux 机器上 MySQL 配置文件的默认位置是什么?

4

8 回答 8

53

刚找到,是/etc/my.cnf

于 2008-12-04T18:28:09.520 回答
46

The information you want can be found by running

mysql --help

or

mysqld --help --verbose

I tried this :

    mysql --help | grep Default -A 1

And the output:

                      (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 
于 2012-04-03T21:26:36.963 回答
19

它位于/etc/mysql/my.cnf

于 2011-12-26T12:05:43.113 回答
7

他们似乎都是不错的候选人:

/etc/my.cnf
/etc/mysql/my.cnf
/var/lib/mysql/my.cnf
...

在许多情况下,您可以简单地使用 ps 检查系统进程列表:

server ~ # ps ax | grep '[m]ysqld'

输出

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

或者

which mysqld
/usr/sbin/mysqld

然后

/usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"

/etc/mysql/my.cnf ~/.my.cnf /usr/etc/my.cnf
于 2015-10-04T08:56:40.610 回答
5

在 RH 系统上,MySQL 配置文件默认位于 /etc/my.cnf 下。

于 2012-04-16T00:03:20.250 回答
5

默认选项按给定顺序从以下文件中读取:

/etc/mysql/my.cnf 
/etc/my.cnf 
~/.my.cnf 
于 2015-07-16T13:42:25.517 回答
3

在 docker 容器(基于 centos 的图像)中,它位于

/etc/mysql/my.cnf

于 2016-08-26T04:42:51.363 回答
1

从'/etc/mysql/my.cnf'的标题:

MariaDB programs look for option files in a set of
locations which depend on the deployment platform.
[...] For information about these locations, do:
'my_print_defaults --help' and see what is printed under
"Default options are read from the following files in the given order:"
More information at: http://dev.mysql.com/doc/mysql/en/option-files.html
于 2016-04-30T15:01:34.707 回答