Setting "max_allowed_packet" -- commandline vs config?
What is the difference between setting the max_allowed_packet
via the MySQL commandline using:
set global max_allowed_packet=100000000;
And setting it by editing the MySQL my.ini (Win) or my.cnf (Linux) config and putting the following code under [mysqld]
:
max_allowed_packet=100M
set global max_allowed_packet = 1000000000
This sets max_allowed_packet
it to 1 billion bytes or 1 GB.
max_allowed_packet=100M
This sets it to 104857600 bytes or 100 MiB.
Assuming your extra zero is unintended, the only difference between setting via command line and config is that the config file supports shorthand using JEDEC binary prefixes. Plus, the
set global
will be lost on server restart.
Another major difference is the fact that thesetting of max_allowed_packet will survive a mysql restart if you set the variable in my.cnf (or my.ini)
Additionally, if you set that variable globally, it would make sense to set the session variables as well, especially if the session needs it.
Ugh, I just read hobodave's answer. Clearer answer. I give him a +1