0

I want to change max_allowed_packet at runtime .using sql statement. is there any sql statement to do that.

Udit Sharma
  • 158
  • 1
  • 2
  • 17
  • Possible duplicate of [How to change max\_allowed\_packet size](http://stackoverflow.com/a/8062996) – eggyal Jan 03 '14 at 10:15

1 Answers1

3

max_allowed_packet is set in mysql config, not on php side

[mysqld]
max_allowed_packet=16M 

You can see it's curent value in mysql like this:

SHOW VARIABLES LIKE 'max_allowed_packet'

You can try to change it like this, but it's unlikely this will work on shared hosting:

SET GLOBAL max_allowed_packet=16777216;

You can read about it here http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html

peterm
  • 91,357
  • 15
  • 148
  • 157
Hyder B.
  • 10,900
  • 5
  • 51
  • 60
  • To elaborate on "*it's unlikely this will work on shared hosting*", as documented under [Using System Variables](http://dev.mysql.com/doc/en/using-system-variables.html): "**The [`SUPER`](http://dev.mysql.com/doc/en/privileges-provided.html#priv_super) privilege is required to set global variables.**" – eggyal Jan 03 '14 at 10:21