Monitoring queries that are causing system bottlenecks is a common and extremely useful task.
MySQL comes by default with the mysqladmin utility, which allows you to perform administrative tasks such as checking the MySQL server’s configuration, status, creating a database and so on.
How to monitor Queries in real time using mysqladmin ?
mysqladmin -u root -p --verbose processlist --sleep 1
Given the command above, replace“root” with the username of the database to be monitored, or keep“root” to monitor all databases. The“–sleep 1” parameter corresponds to the interval in seconds for refreshing the screen.
The command gives the following result:
Meaning of the columns:
user | db | team | info |
User that the camando is running | Database on which the query is being executed | Time in seconds that the query is running | Query being used |