How to check the number of MySQL connections on Linux

Question: I want to check how busy my MySQL server is. Is there a way to check the number of active MySQL connections to a MySQL server?

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

Assuming that you are already on the Linux host where the MySQL server is running, use the following command to find out the number of MySQL connections.

$ sudo netstat -antp | grep :3306 | wc -l

Note that we assume that the 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.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *