How to check the number of MySQL connections on Linux

Last updated on September 27, 2020 by Dan Nanni

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.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean