datadir=/home/mysql/data tmpdir=/home/mysql/tmp pid_file=/home/mysql/logs/server1.pid
# log server messages to:
log=/home/mysql/logs/server1.main.log
# log errors to this log_error=/home/mysql/logs/server1.error.log
# log updates to this binary logfile log_bin=/home/mysql/logs/server1_updates.bin
[client]
socket=/home/mysql/server1.sock
[mysql]
database=mysql
[mysqldump]
all-databases result_file=/tmp/dump.sql
There are four
groups here one for the server, one for all clients,
one for the mysql program, and one for the mysqldump program. The latter two are both clients, but the options we want to list in the file aren’t
common to all clients, so we list them separately.
If an option appears for two applicable groups (for example
[client]
and
[mysql]
), the more specific setting (here, for
[mysql]
) takes precedence.
Lines starting with the hash or pound symbol (
#
) are ignored this allows you to add comments to the configuration file to explain entries. Blank lines are also ignored.
Scope of OptionsThe directives in an options file can apply at different levels depending on where the options file is located:
System-wideSettings apply for all MySQL programs on the system.
The default location fora system-wide options file is
/etc/my.cnf for Linux or MacOS 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
dows_Directory>\my.ini, \my.cnf, C:\my.ini, and C:
\my.cnf. The is the directory Windows is installed in, typically C:\Windows. Under Windows, current versions of the MySQL server (version and above) don’t actually read in an options file by default, so you should
Share with your friends: