Wednesday, August 8, 2012

MySQL max_allowed_packet error

We were restoring a backup file that had a query that was taking a long time to execute and then failing with an error of MySql max_allowed_packet violation.

 This moodle forum was useful.

I edited the my.ini file, changing the value max_allowed_packet from 1 to 8, that cleared up the problem.

A quote from forum
"
That is a mysql setting which is designed to prevent buffer overruns and other security issues in mysql connections. Each time there is a mysql connection, an amount of memory (given by net_buffer_length) is set aside and then increased upto the max_allowed_packet limit. Try editing your my.cnf (or my.ini) file and adding:
max_allowed_packet = 16M
and then increasing the value more if you still get the error.
"

2 comments:

  1. I had the same thing happen again on another server today. I edited the mysql configuration file, my.ini and increased the max_allowed_packet value from 1M to 8M. I can find this file easily since I am using Wamp, I can click on the Wamp icon in the systray and select my.ini from the mysql menu.

    ReplyDelete