Today I got this error message when killing yet another spam in my blog:
“Could not save your blacklist data: Got a packet bigger than ‘max_allowed_packet'”
Pretty interesting error message. It didn’t immediately dawn on me that this was a MySQL related problem, before I started googeling it.
Google-search: max_allowed_packet= mysql
The problem seems to be that the whole blacklist is inserted as one insert into the database, and when it grows beyond 3914 spam listings it just gets so big to post directly to MySQL.
Or as MySQL puts it:
“A communication packet is a single SQL statement sent to the MySQL server or a single row that is sent to the client. ”
The solution is to allow larger packages to be sent to MySQL. Per default MySQL only allows for packages of 1 KB. (the total size of the query). This can be expanded to 16 MB on MySQL 3.x and 1 GB(!) on MySQL 4.x.
Information of how to accomplish that can be found in the MySQL manual: A.2.9 Packet too large.
PS: You either have to be able to administrate the install of MySQL, or you will have to talk to your sysadmin about fixing the problem.
In my case it was just a matter of adding two lines to a configuration file and the problem was history.