MySQL and XAMPP: Change Your Server’s Max Allowed Packet Limit CodeUnit 01 OCT 2010

Just a quick note on how to permanently change your MySQL server’s configuration to allow for a bigger max_allowed_packet limit, basically the variable that controls how long a SQL statement can technically get.

First, locate your my.cnf file, the config file that MySQL generally uses as a default. If you are using XAMPP as your development stack, you’ll find it under C:xamppmysqlbinmy.cnf. Open it up in any text editor (PSPad always works well for me!) and run a search on max_allowed_packet. You should get a result under the #The MySQL Sever heading that reads max_allowed_packet = 1M.

Now it becomes a simple matter of changing that line to whatever you want (limit is 1 GB), e.g. max_allowed_packet = 16M, saving it and then firing up your Services tab and restarting the MySQL service.

Done.

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.