Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
1  
Did you check the command line on the service to make sure that (or where) the .ini file is specified? –  Coding Gorilla Sep 27 '11 at 15:30
    
-2 ?? :-( .... @CG: TBH I am not sure how to check it via the console, can you tell me what command to use? thanks –  Chris Sep 27 '11 at 15:35
1  
I edited your question and removed the unnecessary ranting in hopes that you wouldn't get anymore downvotes. –  GregD Sep 27 '11 at 15:36
    
all I did was say ARRRG lol - love it SE, thanks anyway Greg :) –  Chris Sep 27 '11 at 15:37
1  
@Chris Double click the services in the services.msc console, and look at the "Path to executable", it usually has some parameters after the .exe. –  Coding Gorilla Sep 27 '11 at 15:37

4 Answers 4

up vote 5 down vote accepted

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).

share|improve this answer

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.

share|improve this answer

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!)

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.