Scope of Options

The directives in an options file can apply at different levels depending on where the options file is located:

System-wide

Settings apply for all MySQL programs on the system.

The default location for a system-wide options file is /etc/my.cnf for Linux or Mac OS X systems. Under Linux and Mac OS X, the MySQL server and client programs automatically read in an options file at the default location.

For a Windows system, the possible configuration file paths are <Windows_Directory>\my.ini, <Windows_Directory>\my.cnf, C:\my.ini, and C:\my.cnf. The <Windows_Directory> is the directory Windows is installed in, typically C:\Windows. Under Windows, current versions of the MySQL server (version 4.1.5 and above) don’t actually read in an options file by default, so you should always specify one as we discuss in the section on server-wide options. Note that Windows client programs do read in any existing options files.

Server-specific

Settings apply for the MySQL programs in a particular installation.

The default location for a server-specific options file is <MySQL_directory>/my.cnf for Linux and Mac OS X, and <MySQL_directory>\my.ini for Windows.

The options file is sometimes placed in the data directory, but this is not recommended for two reasons: first, it won’t work if you don’t use the default location of data directory specified when the MySQL installation was compiled. Second, the data directory must be readable by any client programs (and therefore by other users on the ...

Get Learning MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.