How to change MySQL default port on Windows?

last updated
1 reply
3.1K views
2 users
0 likes
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?

The Incubator

Ideas and experiences worth sharing with the world

Join Community
The Incubator

Ask your own questions, comment, vote and do more

This is a FREE community. Please be respectful and polite even when you disagree with others.
82 members 50 topics 108 posts

1 Comment

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.