Chapter 16. MySQL and mSQL System VariablesContents:Several variables can be used to customize the operation of MySQL and mSQL. Many of these are environment variables that are inherited from the user's shell, while others are set via command line options and configuration files. 16.1. MySQL System Variables16.1.1. Environment VariablesThe following variables are specific to MySQL programs. They may be defined in the current shell or as part of a shell script. To set a variable for the MySQL daemon (mysqld), define the variable in the safe_mysqld script that is used to start the daemon or define the variables in the MySQL configuration file (described later in this chapter).
In addition, the MySQL programs use the following environment variables that are routinely set as part of the Unix environment.
16.1.2. Command line variablesThese options are supplied via the -O or -set-variable command line option that is available in most MySQL programs.
16.1.3. The MySQL Configuration FileAs of MySQL 3.22, you may specify both server and client options within a text configuration file. There is one format for this file which takes on different meaning depending on the location of the file. If the configuration file is stored in /etc/my.cnf, the options apply to all MySQL servers and clients on the machine. If it located in the data directory of a MySQL server (e.g., /usr/local/mysql/data/my.cnf) the options effect the operation of that MySQL server. Lastly, if the configuration file is named .my.cnf (note the initial period) and is located in the home directory of a user, it effects any clients run by that user. The format of the file is similar to the one popularized by Windows initialization files. The file is broken up into stanzas, each with a group name enclosed in brackets. Underneath the group name is a list of options. Comments are indicated by a line beginning with # or ;. Each group name is the name of a MySQL client or server program you wish the option to affect. The special group name client affects all MySQL client programs (everything except mysqld). The options given in this file can be any long form command line option to any MySQL command (excluding the double-dash "--" option indentifier). Following is a sample server-wide my.cnf file. [client] port=9999 socket=/dev/mysql [mysqld] port=9999 socket=/dev/mysql set-variable = join_buffer=1M [mysql] host=dbhost unbuffered Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|