MySQL ‘max_allowed_packet’ fix

MySQL ‘max_allowed_packet’ fix

I was trying to import some data into my local MySQL (Mac) and ran into the following error: #1153 – Got a packet bigger than ‘max_allowed_packet’ bytes. I was storing some images in a LongBlob column which was causing this …don’t even bother saying it ;-).

In short, you need to locate your mysql my.cnf config file and add or change the max allowed packet:

[mysqld]
max_allowed_packet = 50M

At the shell, you can type “mysqladmin” and scroll up a bit to see what the default location options are for my.cnf.

In my case, I tried using MySQL Workbench (awesome tool by the way) to change this parameter.  It changed it but it appeared MySQL wasn’t reading Workbenches location for my.cnf (as circled at the bottom of the screen-shot).  I’m not sure why my.cnf wasn’t in a standard directory like “/etc” or why that location was sniffed out by Workbench but since I couldn’t figure out how to tell Workbench to use a different config location, I just coppied my.cnf and modified it and moved it to “/etc”.  Restarted MySQL and all was good.

If anyone knows how to fix the my.cnf location discrepency or what I might be missing , let me know.  Thx! -Rob