Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locating current mysql my.cnf

Tags:

mysql

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?

like image 957
Aglystas Avatar asked Apr 21 '10 13:04

Aglystas


People also ask

How do you find which my CNF is being used?

d/mysql start 2>&1|grep my. cnf should show you the system call used to open the file.

What is my CNF in MySQL?

cnf, /usr/my. This file contains configuration settings that will be loaded when the server is first started including settings for the clients, server, mysqld_safe wrapper and various other mysql client programs. Note: As of 5.6 version, the my. cnf is written, but all the lines are commented out.


1 Answers

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.

like image 93
Unreason Avatar answered Oct 27 '22 06:10

Unreason