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 got a Mac OS X 10.4 box with MySQL installed as part of MAMP, and I want to edit its configuration file. I've tried searching the filesystem for a my.cnf, and all I can find is the example configs.

It all runs fine, so is there something I can run against the MySQL server instance to find out where it loaded its config file from?

share|improve this question
up vote 7 down vote accepted

You can find where MySQL is looking for its config files (so you know where to look, or where to put one) by asking the tools. For example:

dan@Penzance:~/Source/miscellany$ mysql --help | grep cnf
                  order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /opt/local/etc/mysql5/my.cnf ~/.my.cnf

This will show the locations in which it's searching for config files (in order). The server should use the same configs. The example above is from the installation from Macports; yours may be different.

share|improve this answer
Ah, perfect. I guess that they compile-in some non-default settings. – Drarok May 17 '09 at 21:08

It looks like MySQL runs with a default config until a my.cnf file is created... You can create a my.cnf file using the following command:

sudo cp /Applications/MAMP/Library/share/mysql/my-medium.cnf /Applications/MAMP/Library/my.cnf

You now have a my.cnf file where you can adjust the settings.

MAMP ships with 5 configuration files for some typical settings. The filenames should be self explanatory:

share|improve this answer

As mentioned before, MySql looks in a set of predefined locations. But you can specify the option file (that's how they call the config file) by using the --defaults-file parameter. Note this parameter has to precede all other parameters at the command line.

More info:

As for running something against a running instance to find out where it loaded it's config from, I am also searching for that, but haven't found anything so far. I want to double-check whether mysql is loading the right file.

But from the looks of it, it is. One way of checking, is changing the port in your config file, and then see if mysql runs on that new port.

share|improve this answer

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.