MySQL 配置文件位置 - redhat linux 服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/341608/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:46:29  来源:igfitidea点击:

MySQL config file location - redhat linux server

mysqllinuxredhat

提问by user42931

What is the default location for the MySQL configuration file on a redhat linux box?

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

回答by user42931

Just found it, it is /etc/my.cnf

刚找到,是/etc/my.cnf

回答by Nugatu

it is located at /etc/mysql/my.cnf

它位于 /etc/mysql/my.cnf

回答by ThinkingMonkey

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 '
/etc/mysql/my.cnf 
/etc/my.cnf 
~/.my.cnf 
' 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

回答by Sasha

On RH systems, MySQL configuration file is located under /etc/my.cnf by default.

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

回答by B_e_n_n_y_

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

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

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

回答by Nullpointer

All of them seemed good candidates:

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

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

in many cases you could simply check system process list using ps:

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

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

Output

输出

which mysqld
/usr/sbin/mysqld

Or

或者

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

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

Then

然后

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

回答by divandc

From the header of '/etc/mysql/my.cnf':

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

##代码##

回答by Jauyzed

In the docker containers(centos based images) it is located at

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

/etc/mysql/my.cnf

/etc/mysql/my.cnf