Solved: How To End All Running Port 80, Apache And Port 3306, MySql Instance On Ubuntu OS

Xampp is one of the best localhost servers app out there for Ubuntu, especially if you are coming from a Windows environment. It is easy to run your apache and SQL with 2-clicks of the button after installation to start work.

Sometimes, it can be frustrating with starting the apache service and sometimes it might just be another frustration starting the SQL services. I have faced both frustration, and it is not good for your health, especially when you have series of other tasks.


Fixing Apache Server On Ubuntu

So in the case you are facing the issues of starting your apache, but it won't start, instead you keep seeing "stopped" whenever you start the apache server, The first thing to do is kill the server application, like you do on Windows, most times, it is not Skype, it is some program that is using the port 80, which is basically port for the apache.

If after you ended the Skype program, you are still having trouble accessing the apache, copy and paste this command in your terminal;

    "  sudo kill $(sudo netstat -anp | awk '/ LISTEN / {if($4 ~ ":80$") { gsub("/.*","",$7); print $7; exit } }') "

The code will find any application or services using the port 80 and kill it.


Fixing MySQL Database Server On Ubuntu
This same issue also happens on MySql server. It will not start because another service or application is using it. This can also be frustrating, and restarting your PC might not resolve the issue. Since MySQL runs on port 3306, all you have to do is use the same command above, but change 80 to 3306, so it finds the applications or services on the same port, and kill it.
" sudo kill $(sudo netstat -anp | awk '/ LISTEN / {if($4 ~ ":3306$") { gsub("/.*","",$7); print $7; exit } }') "