You're probably here because you were trying to load a MySql database dump and you saw something like this:
bar@foohost:~$ mysql -uroot -p some_database < some_big_dump.db Enter password: ERROR 1153 (08S01) at line 42: Got a packet bigger than 'max_allowed_packet' bytesDon't panic! This one is easy to fix. It's happening because somewhere on either the MySql client or the MySql server, the max_allowed_packet is being exceeded. It's an easy fix, but you will need to bounce your server.
- Edit your
/etc/my.cnfand look for the parametermax_allowed_packet. In my case it was set to 1M, which is obviously not big enough. Set it to something larger (but not insanely large). I changed mine to 16M. - Save the file and bounce MySql (
/etc/init.d/mysql restarton redhat). - Run your import again, but this time specify an explicit maximum packet size on your client as well. Try this command:
bar@foohost:~$ mysql -uroot -p some_database --max_allowed_packet=16M < some_big_dump.db Enter password: bar@foohost:~$
max_allowed_packet a bit bigger.
Once you're done don't forget to set this parameter back to the original size!