Mysql – Identifying processes that open MySQL connections

connectionsdebuggingMySQL

I need to identify which application process issues a large number of MySQL connections on a Linux system.

The show processlist sql command or tools like innotop do not really help, as they only show db user and host, and i doubt that i catch all statements that way.

I was thinking to use something on the network level, like tcpdump or netstat. Any suggestions?

Best Answer

It seems

ss -p '( dport = :mysql )'

does the trick, listing the process ids of the processes on the local machine that connect to the mysql driver's port.