Search for current mysql my.cnf

I am trying to determine which my.cnf mysql is using. Is there a command or something for mysql or mysqladmin that shows which one is loading?

+4
source share
2 answers

On my Linux servers, when I run the script (/etc/init.d/mysql), it defines

CONF=/etc/mysql/my.cnf 

which it uses to run the MySQL daemon

EDIT:

also works

 mysqld --verbose --help 

shows the following information:

 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 you run as a daemon through an init script, it will look for /etc/mysql/my.cnf, and if it is launched from the command line, it will look there only in the second attempt.

+5
source

command

SHOW VARIABLES

Gives you a list of variables that the current mysql instance is using.

There are no traces of the my.cnf variable in the mysql version I am currently running, although this doesn’t help much

You can always set one of the variables to a different value in each of my.cnf, restart the server and use the command above to find out which configuration was loaded.

-2
source

Source: https://habr.com/ru/post/1307546/


All Articles