Databases Reference
In-Depth Information
CHAPTER 11
Using an Options File
Over the course of this topic, you've seen that you can pass options to many of the
programs and scripts that are part of the MySQL distribution. For example, you can
pass the user and password options to the MySQL monitor. If you don't specify a value
for an option, the default options are used. For example, most client programs try to
use the default values localhost and 3306 for the server host and port options,
respectively.
If you need to use an option value that's not the default, you have to specify it each
time you run a program that needs that option; this is tedious and prone to errors.
Fortunately, you can save option values to an options file , also sometimes called a
configuration file , that most of the key MySQL programs and scripts can read. The
programs that read options files include: myisamchk , myisampack , mysql , mysqladmin ,
mysqlbinlog , mysqlcc , mysqlcheck , mysqld , mysqld_safe , mysqldump , mysqlhotcopy ,
mysqlimport , mysql.server , and mysqlshow .
We'll start our tour of options files with an example using the MySQL monitor.
Configuring Options for the MySQL Monitor
Throughout this topic, you've specified the user and password options when starting
the monitor program:
$ mysql --user=root --password= the_mysql_root_password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 486 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
You can save yourself some typing by storing the username and password in an options
file and placing it in a location where the monitor will look. The monitor will auto-
matically read in the option values from the file instead of asking you.
 
Search WWH ::




Custom Search