Changing your default MySQL port can protect you from unauthorized access through brute-force scripts. While non-standard ports may enhance your security, it only extends the time it takes for successful hacking to go through. Therefore, it would help if you had other security measures in place.

You may also require a port change if the standard 3306 is busy.

You can change the default port number of your MySQL server by following the below-listed steps.

Step 1: Open the “my.ini” file in the MySQL installation directory

Step 2: You will see the port with the default number 3306

Step 3: Change the port number 3306 to your desired number

Step 4: Save the changes so that the “my.ini” file is saved

Step 5: Restart your MySQL server so that it picks the changes.

You can then open the “my.ini” file in the server’s installation directory. When you restart MySQL, it will start listening to the new port number.