Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers 3

up vote 6 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
add comment

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:

./Library/share/mysql/my-huge.cnf
./Library/share/mysql/my-innodb-heavy-4G.cnf
./Library/share/mysql/my-large.cnf
./Library/share/mysql/my-medium.cnf
./Library/share/mysql/my-small.cnf
share|improve this answer
add comment

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: http://dev.mysql.com/doc/refman/5.1/en/option-files.html#option-file-options

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
add comment

Your Answer

 
discard

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.