How To Change Apache and MySQL Ports in XAMPP

For certain purposes such as installing two versions of PHP or Install XAMPP More Than One on One Computer, we need to change apache and MySQL port, which for some people it is complicated and difficult to do, therefore, today we’ll discuss how to do that.

How To Change Apache Port in XAMPP

Changing the apache port can’t be done through XAMPP Control Panel, maybe you want to open the config menu located on the upper right corner, but the notice that appears tell us that we have to change the apache port through the configuration file.

Changing Apache and MySQL Ports in XAMPP

In apache, there are two important ports: HTTP port with 80 as the default value and the SSL port at the default value of 443. When the apache module is starting, it will automatically activate both ports, so to change the HTTP port, we also have to change the SSL port, otherwise, it will trigger an error message.

How To Change HTTP Port

To change the HTTP port, open the http.conf file (apache config file) located in the apache/conf directory, find words like “Listen 80” and  “ServerName localhost: 80” then change number 80 to the desired port number, eg 7777, the number must be greater than 1024.

Changing Apache Port Through Configuration File


Changing Apache Port Through Apache's Configuration File

If you install apache from other packages such as WAMPP or the install the apache software directly, you can find the configuration through find files and folder features provided by Windows.

How to Change SSL Port

To change the SSL port, open the httpd-ssl.conf in the apache\conf\extra directory, then find words that contain number 443 (eg: Listen 443 and ServerName localhost: 443), change 443 with other numbers eg: 444, then save the file.

Changing Apache's SSL Port


How to Change MySQL Port

MySQL uses 3306 as it’s default port.

As Apache port, we also can NOT change the MySQL port through the XAMPP Control Panel, to change it we have to edit MySQL configuration file.

To edit the configuration file, open my.ini file located in the XAMPP/mysql/bin/ directory, find words that contain number 3306, eq: port = 3306, then replace it with your own, such as 3307.

Changing MySQL Port


Congratulation, now you successfully change the Apache and MySQL ports in XAMPP.


Subscibe Now

Loves articles on join our newsletter to get quality article right to your inbox. Nothing else, just quality stuff!!!

Our Commitment: We respect your privacy, we'll not share your credential to any party

Related Post

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Like Us


Great information from right to your inbox

  1. Understanding JSONP – With Javascript and jQuery Examples

  2. JSON With Javascript and Ajax

  3. JSON From Database – PHP and MySQL

  4. JSON in HTML Document

  5. JSON With PHP – A Complete Guide

  6. Understanding JSON – A Comprehensive Guide

  7. 7 Best Free Online Image Compressor & Optimizer Tools – Compared & Tested

  8. 40+ Modern Free WordPress Themes For Blog in 2017 – Beautiful & Responsive

  9. Understanding Constant in PHP – Updated to PHP 7

  10. Understanding Variable in PHP – All PHP Version