[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Many MySQL programs have internal variables that can be set at runtime.
As of MySQL 4.0.2, program
variables are set the same way as any other long option that takes a value.
For example, mysql
has a max_allowed_packet
variable that
controls the maximum size of its communication buffer.
To set the max_allowed_packet
variable for mysql
to a value of 64
MB, use either of the following commands:
shell> mysql --max_allowed_packet=6710740 shell> mysql --max_allowed_packet=64M |
The first command specifies the value in bytes. The second specifies the value
in megabytes. Variable values can have a suffix of K
, M
, or
G
(either uppercase or lowercase) to indicate units of kilobytes,
megabytes, or gigabytes.
In an option file, the variable setting is given without the leading dashes:
[mysql] max_allowed_packet=6710740 |
Or:
[mysql] max_allowed_packet=64M |
If you like, underscores in a variable name can be specified as dashes.
Prior to MySQL 4.0.2, program variable names are not recognized as option
names.
Instead, use the --set-variable
option to assign a value to a variable:
shell> mysql --set-variable=max_allowed_packet=6710740 shell> mysql --set-variable=max_allowed_packet=64M |
In an option file, omit the leading dashes:
[mysql] set-variable = max_allowed_packet=6710740 |
Or:
[mysql] set-variable = max_allowed_packet=64M |
With --set-variable
, underscores in variable names may not be given as
dashes for versions of MySQL older than 4.0.2.
The --set-variable
option is still recognized in MySQL 4.0.2 and up,
but is deprecated.