Wednesday, August 3, 2011

Packet for query is too large...setting the 'max_allowed_packet' variable.

Context:

MySQL
Hibernate
Sequel Pro

Problem:

Tried to save a blob, but evidently, the size was larger than the allowed size by MySQL.  For me, the max_allowed_packet size was 1M.  One way that you can find this out is by running: 
SHOW VARIABLES LIKE 'MAX_ALLOWED_PACKET'; 

Solution:

To fix this, I simply increased the size to 5M by running 
SET GLOBAL MAX_ALLOWED_PACKET=5*1024*1024;

Footnote:

I was using Sequel Pro.  After I ran the set query to increase the size, I ran the show variable query.  I expected to see the new size; however, I did not see that.  When I ran the show variable query through mysl at the shell, I saw the new size.  Not sure why.  Anyway, it worked and I don't have time to investigate.  Need to move on to other stuff.

No comments:

Post a Comment