max_allowed_packet on Mac OS X MySQL
While developing a Ruby on Rails application that supported attachments, I ran into an error to the effect, "size exceeds max_allowed_packet". This is because the default installation of MySQL does not accept network packets exceeding 1MB in length.
The solution involves using the MySQL Administrator tool. This is a useful program available as a separate package from MySQL. Unfortunately, it is not very user friendly.
- Click the "Options" button in the top navigation strip
- Choose "Advanced Networking" from the dropdown
- Click the pencil icon next to "Max. packet size:". The words will turn from (disabled) gray to (enabled) black.
- Adjust the size using the text box, arrows, or dropdown.
- Click save. By default, there is no configuration file, so you may be asked to enter administrator credentials to create or modify the file.
The interface allows you to skip 3. and do 4. and 5. without complaint, but the configuration will not be changed. The change can be verified by re-launching the MySQL Administrator and by viewing the contents of /etc/my.cnf.