To change default MySQL port number 3306 in Xampp windows 11|10; Open the my.ini
file, which is located in C:\xampp\mysql\bin on Windows 11|10, and find port 3306
in this file to change it to your custom port number.
There can be many reasons for changing the mysql port number in xampp, like the default port of mysql is 3306, if any other application in your Windows system is running using 3306 port, then xampp mysql server is not working.
How to Change MySQL Port Numbers in Xampp Windows 11|10
Here are some steps for changing the default mysql port number 3306
in XAMPP Server with Windows 11:
Step 1 – Stop Apache and MySQL in Xampp
To change the default port in the XAMPP server, you first need to stop Apache and MySQL in the XAMPP server.
Step 2 – Edit my.ini File
Open the my.ini
file from mysql\bin
configuration directory on any text editor, which is located C:\xampp\mysql\bin
.
Step 3 – Change MySQL Default Port 3306 Number Xampp
Press ctrl + f
and type 3306 to find the default port=3306
number in my.ini
file and change it with another port number; You can change the default port number in the file like this:
port=3306
To
port=3307
Save and close this file to apply the changes.
And config.inc.php, which is in C:\xampp\phpmyadmin\
, Find $cfg['Servers'][$i]['host'] = '127.0.0.1'
line in this file and change it to $cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1:3307’, You can change the default port number in the file like this:
$cfg['Servers'][$i]['host'] = '127.0.0.1'
To
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307'
Step 4 – Restart Apache and MySQL Server in Xampp
Now it’s time to restart Apache and MySQL in Xampp server, Open the XAMPP control panel, and then restart them again.
Conclusion
That’s it; You have learned how to change the default mysql port number 3306 in XAMPP on my.ini
file.