繁体   English   中英

MySQL配置文件位置-Redhat Linux Server

[英]MySQL config file location - redhat linux server

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

刚发现它是/etc/my.cnf

您可以通过运行找到所需的信息

mysql --help

要么

mysqld --help --verbose

我尝试了这个:

    mysql --help | grep Default -A 1

并输出:

                      (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 

它位于/etc/mysql/my.cnf

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

/etc/mysql/my.cnf 
/etc/my.cnf 
~/.my.cnf 

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

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

/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

从“ /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

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

/etc/mysql/my.cnf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM