服务器维护,服务器代维,安全设置,漏洞扫描,入侵检测服务

dirtysea 发表于 2009-9-1 11:39:11

MySQL数据库连接状态查看

MySQL的最大连接数默认是100

客户端登录:mysql -uusername -ppassword

设置新的最大连接数为200:mysql> set GLOBAL max_connections=200;

显示当前运行的Query:mysql> show processlist;

显示当前状态:mysql> show status;

退出客户端:mysql> exit;

查看当前最大连接数:mysqladmin -uusername -ppassword variables |find "max_con"

如:

C:\mysql\bin>mysqladmin -uroot -p variables | find "max_con"
Enter password:
| max_connections | 100

| max_connect_errors | 10



show status 也可以,但不方便。

Threads_connected
The number of currently open connections.

Threads_created
The number of threads created to handle connections.

Threads_running
The number of threads that are not sleeping.

Max_used_connections
The maximum number of connections that have been in use simultaneously since the server started.

Connections
The number of connection attempts (successful or not) to the MySQL server.


其中Threads_running 你可以知道当前运行的线程。不过不如show processlist来得方便。并且还可以知道在正执行什么SQL语句。
页: [1]
查看完整版本: MySQL数据库连接状态查看