Chapter 16. MySQL and mSQL System Variables

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.

MySQL System Variables

Environment Variables

The 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).

MY_BASEDIR, MY_BASEDIR_VERSION

The root directory containing the subdirectories `bin', `var' and `libexec' that contain the MySQL programs and data. A default value of this (usually compiled into MySQL as /usr/local) is used if this variable does not exist. This option affects only the mysqld program.

MYSQL_DEBUG

The debugging level for the program. This option can be used with any MySQL program. The debugging library used by MySQL has many options. A list of all of the available options can be found at http://www.turbolift.com/mysql/appendixC.html. The most common set of options is d:t:o,/tmp/debugfile.

MYSQL_HOST

The hostname used to connect to a remote MySQL database server. This option can be used with any of the MySQL client programs (mysql, mysqlshow, mysqladmin, etc.).

MYSQL_PWD

The password used to connect to the MySQL database server. ...

Get MySQL and mSQL 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.