When we talk about a localhost, the first thing that strikes is Xammp. This software has enabled the doors of Apache and MySQL for every developer on a personal computer. While doing these Localhost works, there occurs many problems. One of the problem is that ‘Apache default port 80 doesn’t work!‘. This problem arises because some other function eats up the port 80. Therefore, you need another. For that, changing the default ports become necessary.

Here, you’ll also learn How you can change the port of MySQL service.

Things to know

After you do the changes given below, there may come a problem in Xampp if the code goes wrong. Or, if the new port is also already in use, Xampp won’t work. For doing these changes, be sure that you won’t change anymore words in the file I suggest you.

So, let’s give a start! 😉

Changing the Apache Ports

Step 1: First, reach in the folder where you have installed your Xampp Software.

Step 2: After that, go to the destination file – apache/conf/httpd.conf

Step 3: Then just open the file in a text editor and find the string Listen 80 . Default number is 80. It means that your Xammp server is 80. Now just change it to any port you want. Here, I have changed it to Listen 82.

Step 4: Just then in the same file, find the string ServerName and then write the same port number you wrote above.

Step 5: Now stay relaxed, close off Xampp and Restart it to use your New Port!

Note*: These would surely change the ports. But, the solution of problem may or may not be solved because of other issue.

Changing the MySQL ports

The default MySQL port is 3306. Sometimes, this needs to be changed. Follow these steps to enjoy your new port.

Step 1: First, reach in the folder where you have installed your Xampp Software.

Step 2: After that, go to the destination file – mysql/bin/my.ini (The ‘my‘ file with extension of Configuration Settings)

Step 3: In that file, you’ll be seeing some lines of code like this:

# The following options will be passed to all MySQL clients
[client] 
# password       = your_password 
port            = 3306
socket          = "xampp / mysql / mysql.sock"

Just change the port to 3306 ---> 3308 instead of 3306.

Step 4: Just below, you would find these lines of code:

# The MySQL server
[mysqld]
port= 3306
socket = "xampp / mysql / mysql.sock"

Just like before, here also update the port attribute to 3306 ---> 3308 instead of 3306.

Step 5: And that’s all! Just close off MySQL and Start it again to see the new port working.

Note*: Just like before, These would surely change the ports. But, the solution of problem may or may not be solved because of other issue.

I hope this technically worked for you. Do write your thoughts below and let me know your feedback on this 🙂

Posted by Kumar Abhirup

Hey guys, Welcome to this fascinating blog IQubex. I'm Kumar Abhirup, a blogger, web designer and a developer from Nasik, the Wine Capital of India! I started IQubex as a hobby and my vision is to make my readers happy and satisfied by answering all their questions on this blog. My age is 13 and I started my developing journey at the age of 10.

Don't miss a chance of commenting!