Mysql – Adding max_allowed_packet to the.cnf stops thesql server

homebrewMySQL

I do Drupal dev work on my Mac using a Homebrew setup for mysql, and on a couple version 6 sites, I get the famous "mysql: server has gone away" error when trying to bring up the status report page. After doing some searching, I have found that the answer seems to be adding the max_allowed_packet settings to the [mysqld] section of my.cnf. So, using the my-medium.cnf file provided in the mysql formula, I place it in /usr/local/etc and add

max_allowed_packet=65M

However, mysql does not like that for some reason. I run mysql.server restart, and it seems to start, but when I try to run a query in my client, but it tells me there is no connection. I then try removing the setting from my.cnf and restart, but instead of restarting, I get

ERROR! The server quit without updating PID file (/usr/local/var/mysql/username.home.pid)

Attempting to reconnect the socket gives me an error saying that either the request times out or unable to connect via the socket (/tmp/mysql.sock in this case). On the Drupal site, I get a "No such file or directory." message.

Can anyone explain why merely adding this value to my.cns causes such results?

Thanks.

EDIT: After examining the my.cnf I was using, I noticed that the [mysqld] section already had max_allowed_packet = 1M. I removed it and created my.cnf that had only

[mysqld]
max_allowed_packet = 64M

and I still get the same result. For some reason, mysql doesn't like it when I add or change that setting.

Best Answer

From the docs, it should be a value in bytes in increments of 1024. http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_max_allowed_packet