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

运维之家

 找回密码
 注册
搜索
查看: 4916|回复: 1

MySQL数据库连接状态查看

[复制链接]
dirtysea 发表于 2009-9-1 11:39:11 | 显示全部楼层 |阅读模式
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语句。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|运维之家

GMT+8, 2024-4-29 19:55 , Processed in 0.184320 second(s), 14 queries .

Powered by Dirtysea

© 2008-2020 Dirtysea.com.

快速回复 返回顶部 返回列表