Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've managed to locate my install directory for MySQL: /usr/local/mysql/

Where can I find the path to my.cnf to know where I should configure the server? I've tried creating a /etc/my.cnf(as shown below) and it had no affect


share|improve this question
Specifics about the distro you are using would be helpful. – Tim Jan 4 '12 at 20:10
Pretty sure debian/*buntu/rhel/cent wouldn't be using /usr/local from a package install. That sounds more like slack or freebsd. – Tim Jan 4 '12 at 21:10
up vote 2 down vote accepted

As per this article:

Running this command from the command line / terminal will show where MySQL will look for the my.cnf file on Linux/BSD/OS X systems:

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

This will output something like this:

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 

You can now check for files using the above output at /etc/my.cnf, then /etc/mysql/my.cnf and so on. If there isn't one at one of those locations, you can create one and know MySQL will use it.

share|improve this answer

On a Linux system 'locate my.cnf" will be the fastest solution.

If there are several my.cnf files, all looking likely (e.g. in /etc, /etc/mysql, /opt/mysql/etc, etc.), then you can run strace to see where MySQL binary tries to find its configuration file, but I do think that's an overkill.

share|improve this answer
I get -bash: locate: command not found... I've tried find / my.cnf but it finds nothing. – Webnet Jan 4 '12 at 20:03
This assumes that your locatedb has been updated since the my.cnf file was create. Usually this is done daily via cron. If you need to update it manually run "updatedb" as root – ckliborn Jan 4 '12 at 20:04
locate: command not found is not an updatedb problem, he doesn't have the package. – Tim Jan 4 '12 at 20:09
install "slocate" package. – TheCompWiz Jan 4 '12 at 20:13

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

share|improve this answer

It seems like the file your cnf created is being superseded by another one. Check out hte default order below.


mysqld --verbose --help

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

share|improve this answer

How are you sure that your cnf file is not being read?

Have you restarted mysqld since the change?

Have you tried to create a new db and looked at its values?

share|improve this answer

How did you install MySQL and on what platform?

Brute force method on an unixoid OS:

find / -name my.cnf -print
share|improve this answer
I didn't install it, it's on a machine that's a few years old. It's on Linux mars 2.6.5-7.147-bigsmp #1 SMP Thu Jan 27 09:19:29 UTC 2005 i686 i686 i386 GNU/Linux – Webnet Jan 4 '12 at 19:31

To install locate and updatedb to be able to run it..

Using fedora, centos run as root:

yum install mlocate

if you are running Ubuntu run:

sudo apt-get install mlocate

After you finish the install run updatedb Fedora (as root):



sudo updatedb

then you can run the locate command as listed above. Again the my.cnf is typically located in /etc. Are you sure mysql is installed? if not do the commands above to install it and replace mlocate with mysqld best of luck!

share|improve this answer

OK a wild shot in the dark:

If the database is installed in /usr/local/mysql, then try looking in /etc/local for my.cnf

Here is how you can tell if you have a my.cnf

Run this query

WHERE VARIABLE_NAME IN ('wait_timeout',


SHOW VARIABLES LIKE = 'wait_timeout';
SHOW VARIABLES LIKE = 'innodb_buffer_pool_size';
SHOW VARIABLES LIKE = 'innodb_log_file_size';

If you should get

  • wait_timeout 28800
  • innodb_log_file_size 5242880
  • innodb_buffer_pool_size 8M (MySQL 5.0) or 128M (MySQL 5.1+)

you are running with defaults and there is a possibility that there may not be a my.cnf present.

share|improve this answer
-bash: updatedb: command not found – Webnet Jan 4 '12 at 20:22
Updated my answer. Please try again !!! – RolandoMySQLDBA Jan 4 '12 at 20:25
/usr/bin/which: no updatedb in (/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/us‌​r/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin:/usr/local/apache2/bin:/us‌​r/local/firefox:/usr/local/mysql/bin:/usr/games:/usr/local/fetter/bin) – Webnet Jan 4 '12 at 20:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.