Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to list down all the running queries in MySQL?
To list running queries, we need to use the ?show processlist' command.
The following is the query.
mysql> SHOW processlist;
The following is the output of the above query.
+----+-----------------+-----------------+----------+---------+-------+------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+-----------------+-----------------+----------+---------+-------+------------------------+------------------+ | 4 | event_scheduler | localhost | NULL | Daemon | 13785 | Waiting on empty queue | NULL | | 9 | root | localhost:63587 | business | Query | 0 | starting | show processlist | +----+-----------------+-----------------+----------+---------+-------+------------------------+------------------+ 2 rows in set (0.00 sec)
Let us display the result horizontally with the help of SHOW command.
mysql> SHOW FULL PROCESSLIST\G;
The following is the output of the above query.
*************************** 1. row ***************************
Id: 4
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon
Time: 17385
State: Waiting on empty queue
Info: NULL
*************************** 2. row ***************************
Id: 9
User: root
Host: localhost:63587
db: business
Command: Query
Time: 0
State: starting
Info: SHOW FULL PROCESSLIST
2 rows in set (0.00 sec)
Advertisements