标题: Mysql查看连接数(连接总数、活跃数、最大并发数) [打印本页] 作者: 定位 时间: 2024-10-13 18:07 标题: Mysql查看连接数(连接总数、活跃数、最大并发数) show variables like '%max_connection%'; 查看最大连接数
set global max_connections=1000; 重新设置最大连接数
mysql> show status like 'Threads%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 32 |
| Threads_connected | 10 |
| Threads_created | 50 |
| Threads_rejected | 0 |
| Threads_running | 1 |
+-------------------+-------+
5 rows in set (0.00 sec)
mysql> show variables like 'thread_cache_size';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 100 |
+-------------------+-------+
1 row in set (0.00 sec)
命令:show processlist;
如果是root帐号,你能看到所有用户的当前连接。如果是其它普通帐号,只能看到自己占用的连接。
show processlist命令只列出前100条,如果想全列出请使用show full processlist;