How to check the number of MySQL connections on Linux

To count the current MySQL connections of a MySQL server, use this Linux command line trick.

Assuming that you are already logged in as root on the Linux host where the MySQL server is running, use below command to find out the number of MySQL connections:

netstat -antp | grep :3306 | wc -l

mysql_connections

NOTE: I hope your MySQL server is running on a default MySQL port (3306). If the MySQL server is using a non-standard port, replace 3306 with the port number.


About Vineesh Mohan

A Technical Support specialist with strong customer service and good communication skills. I live in the city of Cochin, which known as the Queen of Arabian Sea.
Posted in Linux, MySQL, Ubuntu

  • amos91

    You could also instead of greping by port , try to grep by process name

    netstat -atnp | grep mysqld | wc -l