(888) 685-3101 ext. 2

MySQL creates a default configuration file named my.cnf (or my.ini in Windows), that can be edited to include and fine tune the startup options to meet the needs of your environment. This is often more convenient than entering these values every time you start the service.

You can also have this default file point to additional configuration files. MySQL will read the configuration files in a cascading mode and will include the settings from another configuration file in either the default locations (such as /etc/mysql/my.cnf), or in directories in which it is pointed. As of MySQL 5.0.4, the !includedir directive can be used in the original config file to specify directories to find other config files.

While this feature can be quite useful, you need to be careful with naming these additional files. The name of the file must end with ‘.cnf’ and contain no additional period characters. A client of ours had recently created another config file to store their newer replication setup, though they were not seeing those settings executed by MySQL. Their file did end in ‘.cnf’, though in this case, they had used an extra dot (instead of an underscore) to name their file. The additional file was ignored by MySQL until it was renamed appropriately.

Conclusion: Placing your MySQL startup options in more than one config file can help to keep your desired settings organized and uncluttered. Name the new config files with ‘.cnf’ extensions and do not use additional dots in the file name or the options will not be executed.

Share This