How can I change max_allowed_packet permanently?

Hello,

I am using MySQL 4.0.1, on my local win xp machine.

Thank you.

Hi, either by adding the following line (where 16M is data packet size)


max_allowed_packet = 16M

in [mysqld] section of your my.cnf/my.ini file, or by using the following command line:


> mysqld --max_allowed_packet=16M

Check 4.3.2. Using Option Files, [url=http://dev.mysql.com/doc/mysql/en/program-variables.html]4.3.4. Using Options to Set Program Variables and [url=http://dev.mysql.com/doc/mysql/en/server-options.html]5.2.1. mysqld Command-Line Options. You can do the same things for MySQL client programs only like mysql and mysqldump, but my.ini’ sections will be [mysql] and [mysqldump] appropriately

If I use “mysqld --max_allowed_packet=128M” to start the server, it works fine.

But, when I do it like that, I have to do it everytime I start mysqld.

I tried adding “max_allowed_packet=128M” under [mysqld] in my.ini but it doesn’t seem to affect the variables at all. I only have one my.ini (in my mysql folder).

Any suggestions?

(I tried making a batch file, but mysqld simply won’t start with the batch file I made, here’s the contents of that file:


@echo off
cls
d:\\web\\mysql\\mysqld.exe

I don’t want to run it as a server, only when needed. Any help appreciated! :slight_smile:

Hi, if you run MySQL server under Windows 2000/XP/2003, you should install appropriate MySQL executable (mysqld.exe, mysqld-nt.exe, etc.) as a service for more convenience. Check 2.3.12. Starting MySQL as a Windows Service. For instance, to install mysqld.exe as a service name “MySQL41” with configuration file “g:\MySQL4.1\my.ini”, run the following command:



cmd> g:\\MySQL4.1\\mysqld.exe --install MySQL41 --defaults-file="g:\\MySQL4.1\\my.ini"


MySQL server doesn’t read your my.ini since your my.ini is not located under default search paths/names ( C:\WINDOWS\my.ini , C:\WINDOWS\my.cnf , C:\my.ini C:\my.cnf ). You should specify path to your my.ini (see above). Also check 2.3.5.14. The Location of the my.ini File

Thanks for the reply though, I’m gonna try playing with the “–defaults-file=”…\my.ini" argument hoping I strike gold soon.

-Sneef

Hmm… unrecognized argument in the mysql prompt… :confused:

Got it to work by copying my my.ini file to C:\WINDOWS\.

Now all I need to do is create a batch file that starts both apache and mysqld. Tried, but failed, will keep at it and post if I make it work.