![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_1646196261.webp)
Specifying Program Options
241
Be aware that the use of variable prefixes can cause problems in the event that new variables are
implemented for a program. A prefix that is unambiguous now might become ambiguous in the future.
Suffixes for specifying a value multiplier can be used when setting a variable at server startup, but not
to set the value with
SET
at runtime. On the other hand, with
SET
you can assign a variable's value
using an expression, which is not true when you set a variable at server startup. For example, the first
of the following lines is legal at server startup, but the second is not:
shell>
mysql --max_allowed_packet=16M
shell>
mysql --max_allowed_packet=16*1024*1024
Conversely, the second of the following lines is legal at runtime, but the first is not:
mysql>
SET GLOBAL max_allowed_packet=16M;
mysql>
SET GLOBAL max_allowed_packet=16*1024*1024;
Note
Before MySQL 4.0.2, the only syntax for setting program variables was
--set-
variable=option=value
(or
set-variable=option=value
in option
files). Underscores cannot be given as dashes, and the variable name must
be specified in full. This syntax still is recognized, but is now deprecated and is
removed in MySQL 5.5.
4.2.3.6. Option Defaults, Options Expecting Values, and the
=
Sign
By convention, long forms of options that assign a value are written with an equals (
=
) sign, like this:
shell>
mysql --host=tonfisk --user=jon
For options that require a value (that is, not having a default value), the equal sign is not required, and
so the following is also valid:
shell>
mysql --host tonfisk --user jon
In both cases, the
mysql
client attempts to connect to a MySQL server running on the host named
“tonfisk” using an account with the user name “jon”.
Due to this behavior, problems can occasionally arise when no value is provided for an option that
expects one. Consider the following example, where a user connects to a MySQL server running on
host
tonfisk
as user
jon
:
shell>
mysql --host 85.224.35.45 --user jon
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.96 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
SELECT CURRENT_USER();
+----------------+
| CURRENT_USER() |
+----------------+
| jon@% |
+----------------+
1 row in set (0.00 sec)
Omitting the required value for one of these option yields an error, such as the one shown here:
shell>
mysql --host 85.224.35.45 --user
mysql: option '--user' requires an argument
In this case,
mysql
was unable to find a value following the
--user
[232]
option because nothing
came after it on the command line. However, if you omit the value for an option that is not the last
option to be used, you obtain a different error that you may not be expecting:
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...