De acuerdo a Documentación MySQL en max_allowed_packet
Algunos programas como mysql y mysqldump le permiten cambiar el valor del lado del cliente al establecer max_allowed_packet en la línea de comandos o en un archivo de opciones.
En la línea de comandos, para configurarlo en 512M simplemente ejecute mysql client con esto:
C:\>mysql -u... -p...
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.5.12-log MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)
mysql> set max_allowed_packet=1024 * 1024 * 512;
ERROR 1621 (HY000): SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
mysql> set global max_allowed_packet=1024 * 1024 * 512;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)
mysql> exit
Bye
C:\>mysql -u... -p...
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.5.12-log MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name | Value |
+--------------------+-----------+
| max_allowed_packet | 536870912 |
+--------------------+-----------+
1 row in set (0.00 sec)
Tienes que configurarlo globalmente. No puedes configurarlo localmente.
Necesitas el SUPER privilegio para establecer cualquier variable global.
set max_allowed_packet=1024 * 1024 * 512;
, mostró el mensaje de error, corrióset global max_allowed_packet=1024 * 1024 * 512;
con éxito, y luego dijoYou have to set it globally. You cannot set it locally.
. Por lo tanto, mi respuesta es exhaustiva y completa y ha sido así desde el 3 de mayo de 2012.