MySQL is an open source relational database management system and the core of web applications, used to store and access data on the network. In the process of using MySQL, sometimes you need to query the MySQL process to understand the programs currently running in the system.
In MySQL, you can view all current processes through the SHOW PROCESSLIST command. This command will list all processes of running queries, locks, replication, and persistent connections.
The following are the detailed steps to query the MySQL process:
SHOW PROCESSLIST;
Among them, Query ID represents the process ID; User represents the user name to which the process belongs; Host represents the IP address or host name of the client connection; db represents the database currently being used by the process; Command represents the current process. The command being executed; Time represents the time the current process has been executed; State represents the specific status of the current process; Info represents the SQL execution statement executed by the current process.
For example, the following example displays a list of the current MySQL processes:
mysql> SHOW PROCESSLIST; | |
||||||
---|---|---|---|---|---|---|---|
User | Host | db | Command | Time | State | Info | |
root | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST | |
ubuntu | localhost | wordpress | Sleep | 64 |
##NULL |
||
wordpress | localhost | wordpress | Sleep | 242 |
NULL |
||
root | localhost | NULL | Sleep | 0 |
NULL |
The above is the detailed content of How to query the MySQL process. For more information, please follow other related articles on the PHP Chinese website!