Table of Contents
The essential options and system variables are as follows:
--bind-address=
IP_address
--date_format=
format_string
--datetime_format=
format_string
--default-storage-engine=
engine_type
--local_infile=
[0|1]
--sql_mode=
mode
--skip_networking – allow local
connections only
--skip_show_databases
To see the default format that MySQL uses for dates issue the
statement SELECT NOW(); from the MySQL
client. You should see output like the following:
+---------------------+ | NOW() | +---------------------+ | 2007-06-27 16:19:37 | +---------------------+
If you don't find this date/time format suitable, you can change
it by using the --date-format and
--datetime-format options. For example, to
change the date format to a two digit month followed by a two
digit day of the month and a four digit year separated by a
forward slash use the following option:
--date-format=`%m/%d/%Y`. For all the legal
formats see Appendix A, Date Format Specifiers Table.
The --skip-networking option allows only local
(non-TCP) connections. On Unix, local connections use a Unix
socket file and on Windows, they use a named pipe or shared
memory. For a development server you will most likely not want
to use this option. However, some distributions come with this
option activated so it is useful to know about it so that you
can disable it.
Likewise with the --bind-address. This option
binds the MySQL server to a specific IP address, typically
127.0.0.1 effectively disabling access from a
remote location. It is mentioned here so that you know how to
disable it.
In the chapter on MySQL client programs we hinted that there was a better way to make use of command options than specifying them at the command line. Entering options from the command line can be both tedious and error-prone. The better way is to store options in a configuration file so that the need not be specified each time you use a specific program.
Under Windows this file is usually found in the
C:\Program Files\MySQL\MySQL Server 5.0
directory and on Linux ...
Options in /etc/my.cnf and
$MYSQL_HOME/my.cnf are processed before
command-line options, so it is recommended that you put a
--user option in the configuration file and
specify a value other than root. The option in the configuration
file is found before any other --user options,
which ensures that the server runs as a user other than root, and
that a warning results if any other --user option
is found.
Changing the configuration file requires stopping the server. The
easiest way to start and stop the MySQL server under Windows is
from the Microsoft Management Console Services window. To open
this window, go to the Control Panel and find
Administrative Tools. Double click this icon
and then choose Services. Find the MySQL entry,
select it, and stop the service. Also menu item ...
To stop the MySQL server under Linux or Mac OS X use
mysqladmin with the shutdown
command. You may also need to specify other options such as
--user and --password.
You are now ready to make changes to the configuration file.