Database Reference
In-Depth Information
separator. Alternatively, write \ by doubling it as \\ (this is necessary because \ is
the MySQL escape character in strings).
To find out which options the mysql program will read from option files, use this com‐
mand:
% mysql --print-defaults
You can also use the my_print_defaults utility, which takes as arguments the names of
the option-file groups that it should read. For example, mysqldump looks in both the
[client] and [mysqldump] groups for options. To check which option-file settings are
in those groups, use this command:
% my_print_defaults client mysqldump
Mixing command-line and option-file parameters
It's possible to mix command-line options and options in option files. Perhaps you want
to list your username and server host in an option file, but would rather not store your
password there. That's okay; MySQL programs first read your option file to see what
connection parameters are listed there, then check the command line for additional
parameters. This means you can specify some options one way, and some the other way.
For example, you can list your username and hostname in an option file, but use a
password option on the command line:
% mysql -p
Enter password: ← enter your password here
Command-line parameters take precedence over parameters found in your option file,
so to override an option file parameter, just specify it on the command line. For example,
you can list your regular MySQL username and password in the option-file for general-
purpose use. Then, if you must connect on occasion as the MySQL root user, specify
the user and password options on the command line to override the option-file values:
% mysql -u root -p
Enter password: ← enter MySQL root account password here
To explicitly specify “no password” when there is a nonempty password in the option
file, use --skip-password on the command line:
% mysql --skip-password
From this point on, I'll usually show commands for MySQL pro‐
grams with no connection-parameter options. I assume that you'll
supply any parameters that you need, either on the command line or
in an option file.
Search WWH ::




Custom Search