How to determine number of open sockets? VM Resource Issues
netstat -nap
p shows the process id
netstat -an | grep ESTABLISHED | wc -l
This will count all opened sockets in the system and will output just the total. You can of course also change ESTABLISHED for whatever you need, for example a port or a communication status like CONNECTED or LISTENING.
To watch live MySQL opened connections through UNIX socket, run (as root):
watch -n1 'netstat -np | grep -i mysqld'