简体   繁体   中英

Locating current mysql my.cnf

I'm trying to determine which my.cnf mysql is using. Is there a command or something for mysql or mysqladmin that shows which one is being loaded?

On my linux servers in the startup script (/etc/init.d/mysql) it defines

CONF=/etc/mysql/my.cnf

that it uses to start MySQL daemon

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.

the command

SHOW VARIABLES

Will give you a list of variables the current instance of mysql uses.

In the version of mysql I am currently running there is no trace of a my.cnf variable though, so thats not much help

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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