Changing the MySQL my.ini File in Windows Vista

Not sure if I’m the only left that uses Vista with the UAC (User Account Control), but it definitely got me into trouble yesterday.

I tried to change the my.ini (Configuration File for the MySQL Database), but due to some Vista security feature it created a Shadow Copy of the file and MySQL never actually got to see my changes.

You can check this via the MySQL command prompt. In my case I had to adjust the max_allowed_packet setting, so if you run:

mysql> show variables like 'max%' ; 

| Variable_name         | Value      | 
| max_allowed_packet    | 1048576    | 

So, this is a good way to check if your changes actually have an effect.

Now, to change the my.ini file, it helps to know where and how MySQL reads it.

This Section in the MySQL Online help explains it nicely. As a summary, this is where it reads from:

  • WINDIR\my.ini Global options
  • C:\my.cnf Global options
  • INSTALLDIR\my.ini Global Options
  • defaults-extra-file The file specified with --defaults-extra-file=path, if any

If you start MySQL as a service you can also use the defaults-file option. More info here.

What we can do to have our my.ini file read, is to make a copy, store it somewhere outside of the Program Files path and point defaults-file to it. It’s a registry setting:


“C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt” –defaults-file=”C:\MySQL\my.ini” MySQL

Good luck!

Ähnliche Beiträge

Leave a Reply

Your email address will not be published. Required fields are marked *