When you work with the servers, many times you face Address already in use : <port number>.
It’s always tedious to find which process is using this port and then you need to manually kill the process so that you can start your application.
In Window, You can search for the process ids with below steps :
- Open Command Prompt
- Run command netstat -ano | findStr <port_number>
e.g. netstat -ano | findStr “3306”
3. This will show you the list of processes which are connected with 3306 process ids. As shown below :
4. As you can see the first process with 3306 is the main process and then remaining processes are connected to it. So we will kill the process with process id is 4780.
5. In Windows, We have TASKKILL command. To kill the command you need to write below command into command line. TASKKILL /PID <PROCESS_ID> which you discovered through above command.
TASKKILL /PID 4780
6. Many times if you haven’t opened as Run as administrator or Task is being used by multiple processes then it won’t allow you to kill the process and which gives you below error message.
7. To solve above error, you need to open command line as “Run as administrator”.
8. Now as you have opened command line with Admin access to kill the process by force. using command TASKKILL /F /PID <PROCESS_ID> So, in our case it will be TASKKILL /F /PID 4780
Congratulations ! You have successfully killed process into Windows OS.
You can find the detailed help for the Task Kill command by typing TASKKILL /? as shown below or visit Microsoft-TASKKILL.