Structure of the Options File
We saw in the last section how you can specify options for the
MySQL monitor. An options file can have a section for each program that
uses it. For example, you can have a [mysql] section for the mysql program and a [mysqldump] section for the mysqldump program. Similarly, you can have a
[mysqld] section for the MySQL
server daemons mysqld, mysqld_safe, and mysqld-nt.
Where options are common to all client programs, they can be
consolidated under a [client]
section. Similarly, options common to all server programs can be
listed under a [server]
section.
Be careful not to make program options too generic. For example,
the mysql program is a client and
takes a database option. However,
mysqladmin and mysqlshow are examples of client programs
that don’t understand this option. If you include the database option
in the [client] section, like this:
[client] database=music
these programs will just complain and quit, as below:
$mysqladmin statusmysqladmin: unknown variable 'database=music'
You should include the
database option in a separate group
for the [mysql] program, rather
than including it in the [client]
group.
Let’s look at a more interesting options file:
[server] user=mysql port=57777 basedir=/usr/local/mysql-standard-5.0.22-linux-i686 socket=/home/mysql/server1.sock 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access