Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the location of currently used MySQL configuration file in linux

Tags:

linux

mysql

How do I know which configuration file is used by MySQL currently? Is there any command or something to find it out?

like image 377
Albin Joseph Avatar asked Jul 17 '10 05:07

Albin Joseph


People also ask

Where is MySQL configuration file in Linux?

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

Where is MySQL config file Ubuntu?

conf. d/mysqld. cnf which only has [mysqld] pid-file = /var/run/mysqld/mysqld.


2 Answers

The information you want can be found by running

mysql --help 

or

mysqld --help --verbose 

I tried this command on my machine:

mysql --help | grep "Default options" -A 1 

And it printed out:

Default options are read from the following files in the given order: /etc/my.cnf /usr/local/etc/my.cnf ~/.my.cnf 

See if that works for you.

like image 158
GoalBased Avatar answered Oct 05 '22 18:10

GoalBased


mysqld --help --verbose will find only location of default configuration file. What if you use 2 MySQL instances on the same server? It's not going to help.

Good article about figuring it out:

"How to find MySQL configuration file?"

like image 31
Sasha Avatar answered Oct 05 '22 20:10

Sasha