简体   繁体   English

找到当前的mysql my.cnf

[英]Locating current mysql my.cnf

I'm trying to determine which my.cnf mysql is using. 我正在尝试确定哪个my.cnf mysql正在使用。 Is there a command or something for mysql or mysqladmin that shows which one is being loaded? 是否有一个命令或mysql或mysqladmin的东西,显示正在加载哪一个?

On my linux servers in the startup script (/etc/init.d/mysql) it defines 在我的Linux服务器上的启动脚本(/etc/init.d/mysql)中定义

CONF=/etc/mysql/my.cnf

that it uses to start MySQL daemon 它用来启动MySQL守护进程

EDIT: 编辑:

also running 还跑

mysqld --verbose --help

shows the following info: 显示以下信息:

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

So if run as a daemon through init script it will look into /etc/mysql/my.cnf and if started from the command line it will look there only on the second attempt. 因此,如果通过init脚本作为守护进程运行,它将查看/etc/mysql/my.cnf,如果从命令行启动,它将仅在第二次尝试时查看。

the command 命令

SHOW VARIABLES 显示变量

Will give you a list of variables the current instance of mysql uses. 将为您提供当前mysql实例使用的变量列表。

In the version of mysql I am currently running there is no trace of a my.cnf variable though, so thats not much help 在我目前运行的mysql版本中,虽然没有my.cnf变量的痕迹,所以这没什么帮助

You can always set one of the variables to a different value in each of your my.cnf's, restart the server and use the above command to figure out which configuration it loaded. 您始终可以在每个my.cnf中将其中一个变量设置为不同的值,重新启动服务器并使用上面的命令来确定它加载的配置。

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

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