Many MySQL programs have internal variables that can be set at
runtime. 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 16MB, use either of the
following commands:
shell>mysql --max_allowed_packet=16777216shell>mysql --max_allowed_packet=16M
The first command specifies the value in bytes. The second
specifies the value in megabytes. For variables that take a
numeric value, the value can be given with a suffix of
K, M, or
G (either uppercase or lowercase) to indicate
a multiplier of 1024, 10242 or
10243. (For example, when used to set
max_allowed_packet, the suffixes indicate
units of kilobytes, megabytes, or gigabytes.)
In an option file, variable settings are given without the leading dashes:
[mysql] max_allowed_packet=16777216
Or:
[mysql] max_allowed_packet=16M
If you like, underscores in a variable name can be specified as dashes. The following option groups are equivalent. Both set the size of the server's key buffer to 512MB:
[mysqld] key_buffer_size=512M [mysqld] key-buffer-size=512M
Note: Before MySQL 4.0.2, the
only syntax for setting program variables was
--set-variable=
(or
option=valueset-variable=
in option files). This syntax still is recognized, but is
deprecated as of MySQL 4.0.2.
option=value
Many server system variables can also be set at runtime. For details, see Section 5.2.4.2, “Dynamic System Variables”.

User Comments
you can set max_allowed_packet at the mysql prompt:
mysql> set global max_allowed_packet=16777216;
but using this form will NOT work
mysql> set global max_allowed_packet=16M;
ERROR 1232: Wrong argument type to variable 'max_allowed_packet'
Add your own comment.