Search code examples
macostelnetlsof

On mac, lsof says a port is not in use, but I can telnet to the port


If I run lsof, it says that this port is not in use. Yet, I can telnet into it and something is listening on that port.

Am I using the wrong command to see what ports are in use? I'd like to kill the process listening on 3306.

±  |master ✓| → lsof -i :3306

  |2.3.1| montana in ~/workspace
±  |master ✓| → telnet localhost 3306
Trying ::1...
Connected to localhost.
Escape character is '^]'.
J
5.6.39|=X%N9r�&a;AtF>E!r>{mysql_native_passwordConnection closed by foreign host.

Solution

  • To check which process is running on 3306 port sudo lsof -i tcp:3306 and if you get the process id kill -9