查看mysql当前连接数

 

1、查看当前所有连接的详细资料:
mysqladmin -uroot -proot processlist

D:\MySQL\bin>mysqladmin -uroot -proot processlist
+-----+------+----------------+---------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+----------------+---------+---------+------+-------+------------------+
| 591 | root | localhost:3544 | bbs | Sleep | 25 | | |
| 701 | root | localhost:3761 | | uery | 0 | | show processlist |
+-----+------+----------------+---------+---------+------+-------+------------------+


2
、只查看当前连接数(Threads就是连接数.):
mysqladmin -uroot -proot status

D:\MySQL\bin>mysqladmin -uroot -proot status
Uptime: 2102 Threads: 3 Questions: 15531 Slow queries: 0 Opens: 0 Flush tab
les: 1 Open tables: 61 Queries per second avg: 7.389


3
、修改mysql最大连接数:

查看mysql的最大连接数: show variables like 'max_connections' 
打开my.ini,修改max_connections=100(默认为100)

命令: show processlist; 
如果是root帐号,你能看到所有用户的当前连接。如果是其它普通帐号,只能看到自己占用的连接。 
show processlist;
只列出前100条,如果想全列出请使用show full processlist;

 

你可能感兴趣的:(mysql)