SHOW PROCESSLIST shows you which threads are running. You can also get this information using the mysqladmin processlist command. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MySQL account that you are using). See Section 13.5.5.3, “KILL Syntax”. If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.
This statement is very useful if you get the “too many connections” error message and want to find out what is going on. MySQL reserves one extra connection to be used by accounts that have the SUPER privilege, to ensure that administrators should always be able to connect and check the system (assuming that you are not giving this privilege to all your users).
The output of SHOW PROCESSLIST may look like this:
发表评论 评论 (2 个评论)
我知道用 show variables;可以查看系统设置的允许最大连接数 max_connections 和允许每个用户的最大连接数max_user_connections ,用show status; 可以查看系统当前的总连接用户数Threads_connected (是连接的用户,不是连接,一个用户同时可有多个并发连接吧?不是很懂。)
但是就是不知道怎么查看自己的当前活动连接数。
下面这段是摘自mysql的官方文档:http://dev.mysql.com/doc/refman/5.0/en/show-processlist.html
13.5.4.20. SHOW PROCESSLIST Syntax
SHOW [FULL] PROCESSLIST
SHOW PROCESSLIST shows you which threads are running. You can also get this information using the mysqladmin processlist command. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MySQL account that you are using). See Section 13.5.5.3, “KILL Syntax”. If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.
This statement is very useful if you get the “too many connections” error message and want to find out what is going on. MySQL reserves one extra connection to be used by accounts that have the SUPER privilege, to ensure that administrators should always be able to connect and check the system (assuming that you are not giving this privilege to all your users).
The output of SHOW PROCESSLIST may look like this:
mysql> SHOW FULL PROCESSLIST\G