How do I find where MySQL is loading its config from?
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?
Solution 1:
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.
Solution 2:
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