You can also get thread information from the INFORMATION_SCHEMA.PROCESSLIST table or the mysqladmin processlist command. If you do not have the PROCESS privilege, you can view only your own threads. That is, you can view only those threads associated with the MySQL account that you are using. If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.
I am on a test MySQL database and currently, no process is running on it. On a busy database, you would see a longer list than shown below.
SHOW PROCESSLIST produces the following columns:
- Id: Connection identifier
- User: MySQL user who issued the statement
- Host: Host name of the client issuing the statement
- db: Default database selected; otherwise NULL
- Command: Type of command that the thread is executing
- Time: Time (in seconds) that the thread has been in its current state
- State: Action, event, or state indicating what the thread is doing
- Info: Statement that the thread is executing; otherwise NULL
The PROCESS privilege permits you to see all threads.
Using the SHOW FULL PROCESSLIST statement is very useful if you get a “too many connections” error message and want to determine which statements are executing. MySQL reserves one extra connection to be used by accounts that have the SUPER privilege. This ensures that even if the connection limit has been reached, an administrator can always connect and check the system, assuming that application users do not have the SUPER privilege.
Use the KILL statement to kill processes. If the process is running in a terminal that you can access, you can kill it with the “CTRL + C” keyboard combination, although this is less clean than using KILL.