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
max_allowed_packet is a dynamic parameter in mysql 5.1.
You can set it when mysql server on the runtime.
using mysql to connect to the server like this:
mysql -h”remote_host” -u’user’ -p’password’.
after login in. you can using:
set global max_allowed_packet=50M
to set max_allowed_packet. No need to change my.cnf and restart mysql server.
you can refer to mysql reference at:
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_max_allowed_packet
pickup.lichun, awesome tip, thank you!
What’s that app in the screenshot? Is it mysql workbench?
Yes, it’s Workbench.
much thanks, worked perfectly for me.
Glad it helped @matt!
hi, i’ve tried the same command but it didn’t work.. any ideas where i could fix it manually?
@HiThere, what command? You can just edit “max_allowed_packet” in your my.cnf manually.
It is very useful tutorial