Change MYSQL Port on Windows
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
Solution 1:
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:
- Right-click on the service name
- 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.
Solution 2:
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!)
Solution 3:
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.
Solution 4:
In MySQL 5.6, the configuration file, my.ini, is located in a hidden folder named C:/ProgramData. You can open the MySQL Command-line utility, and type in "status" to see the port in use.