Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL show processlist description

Shulou Source: shulou.com Published: 2022-06-01 12:19:22 11月12日 Update

Show processlist and show full processlist

The output of the processlist command shows which threads are running, not only the current number of connections, but also the current connection status to help identify problematic query statements, and so on.

If it is a root account, you can see the current connection 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 items. If you want to list it all, you can use the SHOW FULL PROCESSLIST command

Mysql > show processlist +-+-+ | Id | User | Host | db | Command | Time | State | Info | + +-+ | 1 | root | localhost | NULL | Sleep | 12 | NULL | | 2 | root | 192.168.100 . 1Plu7437 | test | Sleep | 8035 | NULL | 3 | root | 192.168.100.1 NULL 7438 | NULL | Sleep | 24348 | | NULL | 5 | root | 192.168.100.1 NULL 7443 | NULL | Sleep | 24317 | | NULL | 7 | root | 192.168.100.1Suzhou 7450 | test | Sleep | 24272 | NULL | | | 9 | root | 192.168.100.1 Query 5152 | test | Query | 0 | init | show processlist | +-+-- + 6 rows in setmysql > show full processlist | +-+-- + | Id | User | Host | db | Command | Time | State | Info | | +-+ | 1 | root | localhost | NULL | Sleep | 19 | | NULL | | | 2 | root | 192.168.100.1Sleep 7437 | test | Sleep | 8042 | NULL | 3 | root | 192.168.100.1Sleep 7438 | NULL | Sleep | 24355 | NULL | 5 | root | 192.168.100.1pur7443 | NULL | 24324 | NULL | 7 | root | 192.168.100. 1Plu7450 | test | Sleep | 24279 | | NULL | | 9 | root | 192.168.100.1 root | test | Query | 0 | init | show full processlist | +-+ -+ 6 rows in set

The meaning of each column:

① .id column, the "connection_id" assigned by the system when the user logs in to mysql, which can be viewed using the function connection_id ()

The ②. User column, which displays the current user. If it is not root, this command displays only sql statements within the scope of the user's permissions.

③ .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.

The ④ .db column showing which database the process is currently connected to

⑤ .command column, which shows the commands executed by the current connection. Generally, the values are sleep, query, connect, etc.

The ⑥ .time column, which shows the duration of this state in seconds

The ⑦. State column, which shows the status of the sql statement using the current connection, a very important column. State describes a state in the execution of a statement. A sql statement, taking a query as an example, may need to go through copying to tmp table, sorting result, sending data and other states before it can be completed

The ⑧. Info column, which displays this sql statement, is an important basis for judging problem statements.

"in a master-slave replication environment, show processlist or show full processlist is helpful in determining status, such as the following state column:"

Tags: Statement status user command question query important account help ordinary master-slave function unit meaning data database time permission environment port Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft OPPO Reno Shulou Technology Apple NVidia