...

View Full Version : Problem with "packet bigger than 'max_allowed_packet' error"



jeddi
12-25-2011, 03:33 PM
Hi
I am running an update to a database and I keep getting this error:


Could not Insert to CB_MAIN (update)Got a packet bigger than 'max_allowed_packet' bytes

And it is from this code:[PHP]
$result_upd = mysql_query($sql_upd) or write_error("Could not Insert to CB_MAIN (update)".mysql_error()." \r\n");

The write_error() function writes to a log and on line no. 79,870 I get that error.

Searched and read this:


You probably have to change it for both the client (you are running to do the import) AND the daemon mysqld that is running and accepting the import.

But didn't understand it.

My system is as follows:

Operating system CentOS Linux 6.0
Perl version 5.010001
Path to Perl /usr/bin/perl
BIND version 9.7.0
Postfix version 2.6.6
Apache version 2.2.15
PHP version 5.3.2
Webalizer version 2.21-02
Logrotate version 3.7.8
MySQL version 5.1.52

Would much appreciate it if some would help me by telling me what config files need to be changed and where they might be.

Thanks.


.

jeddi
01-03-2012, 07:26 AM
Can someone help me out on this ?

Thanks

sunfighter
01-03-2012, 02:26 PM
I am not an expert here and only answer because this question has been without an answer for a long time.

Your error is explained on this page of the mysql manual: http://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html It basically says
The largest possible packet that can be transmitted to or from a MySQL 5.5 server or client is 1GB. When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection. The mysqld also known as the MySQL Server is limited to 1Mb. They then say it's possible to increase this through CMD start command.

Looking in the ini file for my php I came to this section:

# The MySQL server
[wampmysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=c:/wamp/bin/mysql/mysql5.5.16
log-error=c:/wamp/logs/mysql.log
datadir=c:/wamp/bin/mysql/mysql5.5.16/data

If you can, change this line
max_allowed_packet = 1M to 8M or 16M or 32M. As you can see my setup is on my computer and I use WAMP so your milage my be different.
Good Luck and Happy New Year.

jeddi
01-03-2012, 06:35 PM
Thanks for helping out

What confuses me is the this:


The largest possible packet that can be transmitted to or from a MySQL 5.5 server or client is 1GB.
So both are capable of the same ?


When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection.

Which one is being changed by the php.ini file ?
The client or the server s/w?

BTW I have increased the php.ini value up to 32MB

I see what happens ;)

Thanks again.



.

Lamped
01-03-2012, 08:37 PM
You want to change the my.cnf file for your MySQL installation. Delete any lines with max_allowed_packet= and put in max_allowed_packet=32M (change the figure to suit). Restart MySQL and you should be set.

Reference:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_allowed_packet



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum