How to change MySQL default port on Windows?

last updated
1 reply
2 users
anonymous_2 21 Jun 2011
I want to change MySQL port from the default 3306 to something else to make my server more secure. How do I go about doing that?

1 Comment

Like what you see?

Our one-click login makes it easy to share your thoughts. You can ask your own questions, get email notification of replies to your posts, add your comments, and give a thumb-up to the things you like.

Just use your Facebook/Google/Clever Dodo account to login.

gices 21 Jun 2011
Here are the steps you will need to follow to change the port MySQL server is listening to on your Windows machine:

1. Open the file my.ini located at C:\Program Files\MySQL\MySQL Server 5.5
2. You will find the line port=3306 and all you need is to enter a different value for the port number.
3. Save the changes (you might need to run notepad in administrator's mode to be able to save your changes)
4. Go to services and restart MySql service (or you can restart your PC or Windows server)

Note: You will need to update your config files (Web.Config) to reflect the changes, otherwise you'll find database connection problems as the port has been changed.