Change MYSQL Port on Windows

Looking at the command line in the services console (services.msc) will tell you specifically where the proper .ini file is, and then you can modify that file (and hopefully get the results you want).

The command line specified for the service is shown in the Service's properties dialog. To find it:

  1. Right-click on the service name
  2. Click properties

Read the "Path to executable:" value. This is the command line used for the service. MySql will specify the --defaults-file option which has a path to the my.ini file.


Just head over to your C:\Program Files\MySQL\MySQL Server 5.5\ and you will find various .ini files there eg. my-huge.ini, my-small.ini, my-template.ini, my-large.ini (and most probably my.ini too).

By default MySQL Server 5.5 will look for C:\Program Files\MySQL\MySQL Server 5.5\my.ini (unless another file is defined on the service command line using the --defaults-file= option)

So I'm guessing that your problem is not that the MySQL service is not parsing the correct .ini file (since you created it in the correct path and with the correct name) rather than the content in the file itself. Just a my.ini file with the content you're mentioning on your question is not enough.

Find my-small.ini in the folder above, rename it to my.ini, then open the file with notepad and edit the line

[mysqld]
port = 3306

to

[mysqld]
port = 44999

Restart the mysql service from within the Windows Service Manager (right click on My Computer -> Manage -> Services and Applications -> Services) and your MySQL server should now be listening on port 44999 (remember you'll have to open this port on the Windows Firewall too!)


Did you install it in the default manner with default settings?

Randomly sticking an ini file in there won't do any good if the application isn't set to read that location for settings...

At this point I'd get the sysinternals procmon tool (free) and have it watch as you reload the server application, then look and see what file location(s) it is looking in for its configuration. Might find the actual config file somewhere on your system too using that tool, then change the settings there.