Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

With netstat -a I can see all connections from my machine to the MySQL Server. There is any way too see which process or executable is responsible for each connection?

The only solution I found so far is to listen the packets and analyse the data inside it. But what if the data couldn't provide information about the process?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Use the -b switch as well:

  -b            Displays the executable involved in creating each connection or
                listening port. In some cases well-known executables host
                multiple independent components, and in these cases the
                sequence of components involved in creating the connection
                or listening port is displayed. In this case the executable
                name is in [] at the bottom, on top is the component it called,
                and so forth until TCP/IP was reached. Note that this option
                can be time-consuming and will fail unless you have sufficient
                permissions.

example:

$netstat -ab

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    john:epmap             john:0                 LISTENING       1404
  c:\windows\system32\WS2_32.dll
  C:\WINDOWS\system32\RPCRT4.dll
  c:\windows\system32\rpcss.dll
  C:\WINDOWS\system32\svchost.exe
  C:\WINDOWS\system32\ADVAPI32.dll
  [svchost.exe]

  TCP    john:3150              18-24-50-20.rdsnet.ro:50087  SYN_SENT        392
  [deluged.exe]

  TCP    john:3155              ool-18d24.static.optonline.net:20170  SYN_SENT        392
  [deluged.exe]

  TCP    john:3157              69-62-57-59-adsl-tan.dynamic.so-net.net.tw:10365  SYN_SENT        392
  [deluged.exe]
share|improve this answer
    
Ah, I like your answer better. Upvote! –  dsolimano Apr 20 '10 at 16:50
add comment

Sysinternals Process Explorer tells you which connections are open by application, though I don't know if there is a way to do the reverse look up by connection. If you don't have too many processes to check, this should work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.