Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using windows server 2003, using iis6.

How to change the mysql packet size?? I cant find any my.cnf files in my server. Please help

I tried to copy and paste from mysql sample file, when i rename it, i rename to ".my.cnf", but got errors. Anyone can help me?

share|improve this question

It's my.ini on windows.

...and it should be structured like:

share|improve this answer
Short and to the point. I like it. +1 – John Gardeniers Oct 23 '09 at 9:43

On linux, well CentOS at least, you would edit /etc/my.cnf and add the same text as randy melder says. There is likely to already be [mysqld] in my.cnf so you just need to add the second line: max_allowed_packet=16M

It's important that this line is somewhere under [mysqld] not another [] header in this file as the setting won't be picked up.

You would then need to restart the MySQL server (mysqld) as otherwise it won't know about your change since it only reads /etc/my.cnf when it starts up. Restarting mysqld forces it to re-read my.cnf and pick up your change.

To restart mysqld:

/etc/init.d/mysqld restart


Why would you want to increase your packet size? One top reason is if you are importing a large MySQL database in the form of a plain text file, e.g. using this command

mysql -u username -p -h localhost databasename < data.sql


Reasons for this are for example if you are moving databases between servers or restoring a database from a backup. Or if your file size is too large for another method, e.g. import via phpmyadmin

These mysql database export dump plain text files can get large in the order of several 10s of Mb and the default packet size setting can be quite small relatively in comparison.

With that default setting you might not be able to do the import and you would therefore be presented with the error message: "ERROR 1153 (08S01) at line 53: Got a packet bigger than 'max_allowed_packet' bytes".

So setting max_allowed_packet as described in the answer above can cure that problem, provided your setting is larger than the file you want to import.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.