View the number of current mysql connections show processlist

show processlist和show full processlist

The output of the processlist command shows which threads are running. Not only can you view all the current connections, but you can also view the current connection status to help identify problematic query statements.

If you are the root account, you can see the current connections of all users. If it is another ordinary account, you can only see the connection occupied by yourself. showprocesslist can only list the current 100 entries. If you want to list them all, you can use the SHOW FULL PROCESSLIST command

 

The meaning of each column:

①.id column, the "connection_id" assigned by the system when the user logs in to mysql, you can use the function connection_id() to view the
②.user column to display the current user. If you are not root, this command will only display
the sql statement in the scope of the user’s authority ③.host column, which shows which ip and which port the statement is sent from, and can be used to track the user who has the problem statement
④.db column, which displays this Which database is the process currently connected to
? ⑤.command column, which shows the command executed by the current connection, generally the value is sleep (sleep), query (query), connection (connect), etc.
⑤.time column, which shows the duration of this state , the unit is seconds⑦
. The state column shows the status of the SQL statement using the current connection, a very important column. state describes a certain state in statement execution.
A sql statement, taking a query as an example, may need to go through the states of copying to tmp table, sorting result, sending data, etc.

Guess you like

Origin blog.csdn.net/zs319428/article/details/102778505