How to change MySQL default port on Windows?

Posted by
3.5K views
1 reply
2 users
anonymous_2
gices
+
+
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 Reply

gices
gices Level 6
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.