The processlist command looks at the mysql thread

  • 2020-05-07 20:35:08
  • OfStack

1. Enter mysql/bin and enter mysqladmin processlist;
2. Start mysql, enter show processlist(close kill id;) ;
If you have SUPER permissions, you can see all the threads, otherwise, you can only see the threads you started (that is, the threads currently running on the corresponding MySQL account).
The form of data obtained is as follows (only 3 are intercepted) :
mysql > show processlist;
+-----+-------------+--------------------+-------+---------+-------+----------------------------------+----------
| Id | User | Host | db | Command | Time| State | Info
+-----+-------------+--------------------+-------+---------+-------+----------------------------------+----------
|207|root |192.168.0.20:51718 |mytest | Sleep | 5 | | NULL
|208|root |192.168.0.20:51719 |mytest | Sleep | 5 | | NULL
|220|root |192.168.0.20:51731 |mytest |Query | 84 | Locked |
select bookname,culture,value,type from book where id=001
So let's just say a little bit about the meaning and the purpose of each of the columns 1, column 1, id, needless to say, 1 identifier, which is useful when you're asking for kill1 statements. The user column displays a list of previous users. If not root, this command displays only sql statements that are within your jurisdiction. The host column, showing which port of which ip the statement was issued from. Ha ha, can be used to track the problem statement of the user. Column db, which shows which database the process is currently connected to. The command column, which displays the execution command of the current connection, is usually sleep (sleep), query (query), join (connect). time column, the duration of this state, in seconds. state column, displayed with the current connection state of sql statement, it is very important to the column, the subsequent will have all the description of the status, please note that state just a one state of statement execution, 1 sql statements, has query, for example, may need to pass copying to tmp table, Sorting result, Sending data state can be completed, such as info columns, display the sql statement, because the length is limited, So the long sql statement is not fully displayed, but it is an important basis for judging the problem statement.


Related articles: