The Incubator

It takes 21 years to be 21, let's not rush it

Online Community
The Incubator

How to change MySQL default port on Windows?

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?
last updated
1 reply
2 users

1 Comment

Add a 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.