Mysql – Change MYSQL Port on Windows

MySQLwindows-server-2003

I need some assistance changing the port that MySQL is running on.

So, according to http://dev.mysql.com/doc/refman/5.1/en/option-files.html

MySQL first looks for conf in WINDIR\my.ini, WINDIR\my.cnf ….etc…….

None of these files exist, not even my.ini in the install dir.

Therefore I created my.ini in the install dir…
@C:\Program Files\MySQL\MySQL Server 5.5\my.ini

The contents of the file is:

port=44999

I have tried various things with this ini, I used the examples, but when ever I go to services.msc and restart the MySQL55 service after having saved the updated ini, it always freakin starts on the default port 3306

Best Answer

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.