Sometimes, when you install a new application on your server, they may compete/clash with port numbers already been used by other applications. This may cause your server to slow down, some applications to crash or even servers to crash occasionally.
One such instance is MySQL crashing periodically after I installed a certain application. Unfortunately, this application uses port 3306, and it has no method to specify a different port. MySQL default port is 3306. And it has good flexibility to change its port.
So let us see how.
Go to [path-to-xampp-folder]/mysql/bin/ and open the file my.ini. Or from Xampp, click on Config at the MySQL Module.
Locate the line(s) containing '3306' no. and change it to '3390' or something else and save. Note to change both the server and client parts as shown in the figure below.
Please make sure the new port number is not used by any other service. You can use 'Netstat' to check all used ports on your system.
We need to change the way phpMyAdmin connects to MySQL so that it knows that it has to use the new port number instead of the default one. Failing to do so, will cause the following error whenever you try to connect to MySQL.
From xampp control panel, click on the config for the apache server, and select the phpMyAdmin.ini and make the following changes as shown below
Edit all configuration files in your webserver that connect to this MySQL instance with the new port number.
Failing to do this will cause the web apps to fail.
Based on how your app connects to the MySQL server, either in the config file or a function, ensure that it knows that we are not connecting via the default port anymore.
In my case, my App had a function connecting to the MySQL
And everything is back working!!!
If you ever have to change the port of your MySQL server, ensure that you configure it both on servers, client connections, phpMyAdmin, and the connecting app(s).