Page 1 of 1
How do I change max_allowed_packet in MySQL?
Posted: Mon Aug 29, 2005 3:54 pm
by Swede78
I need to increase the max_allowed_packet in order to upload large data files into a BLOB field. After googling this, I've found several instructions all involving changing the "my.cnf" file. But, I don't have this file! How do I change this value? I can't find any config type files.
I have MySQL 4.0.23 on Windows Server 2003.
Thanks, Swede
Posted: Mon Aug 29, 2005 5:01 pm
by feyd
you shouldn't have to increase the size. PHP handles breaking the data into properly sized packets.
What size files are you trying to place in the BLOB? Is it in fact a BLOB, or is it a MEDIUMBLOB or what?
Posted: Tue Aug 30, 2005 10:04 am
by Swede78
It's a MEDIUMBLOB, and the size of the data being put in is up to 8MB. In this case, php is not being used to communicate with MySQL. So, I'm getting a "packet too large" error.
The strange thing is that I have no configuration files. I can't find a "my.cnf" file. I found on mysql.com a line to enter into the mysql client program that will increase it.
mysql> mysqld --max_allowed_packet=16M
Before MySQL 4.0, use this syntax instead:
mysql> mysqld --set-variable=max_allowed_packet=16M
However, I am guessing that this only temporarily changes it and if it gets re-booted, it will go back to the default. I just have to test that at a non-busy time.
Also, here's what mysql.com says about adding it to the config file:
You can also use an option file to set max_allowed_packet. For example, to set the size for the server to 16MB, add the following lines in an option file:
[mysqld]
max_allowed_packet=16M
Before MySQL 4.0, use this syntax instead:
[mysqld]
set-variable = max_allowed_packet=16M
But, what option file? What is this option file called, and where is it located. I went through each mysql/ directory, and did not find any config file.
Thank you, Swede