Archive for the ‘bugs, features, and errors’ Category

Mysql Server Has Gone Away

November 16, 2008

while hacking around in wordpress i encountered an annoying error: “Mysql server has gone away”.

the reason for “mysql server has gone away” in my case has been a too large sql query. while the content field for options in wordpress is defined as longtext (~2^32 bytes), the connection between php and the mysql server has a much smaller restriction: max_allowed_packet. in my case this was set to 1 mb (afaik, the default value). the option table entry is clearly above (~2mb). i figured this out after some debugging using your queryWithReconnect function. after setting max_allowed_packet to 16M in the [mysqld] section in my.ini, everything worked flawless.

if this doesn’t solve your problem, try the workaround by rob.

Advertisements