Think before you speak, read before you think.

mysql连接数

by

in

默认的MySQL数据库,其最大连接数max_connections= 100

查看当前系统连接数设置
MariaDB [(none)]> show variables like ‘max_connections’;

max_connections代表的意义是

查看当前连接详细

show processlist;
show full processlist;

查看当前的连接数

show status like “Threads%”;
+—————————+——-+
| Variable_name | Value |
+—————————+——-+
| Threads_cached | 4 |
| Threads_connected | 3 |
| Threads_connected_reserve | 1 |
| Threads_created | 7 |
| Threads_running | 3 |
+—————————+——-+
5 rows in set (0.00 sec)

status也可以查看当前连接的id号,Threads也是连接数

MariaDB [(none)]> status;
————–
mysql Ver 15.1 Distrib 5.5.33a-MariaDB, for Linux (x86_64) using readline 5.1

Connection id: 6213994
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ”
Using delimiter: ;
Server: MariaDB
Server version: 5.5.33a-MariaDB-log MariaDB Server, wsrep_23.7.6.rXXXX
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 236 days 16 hours 13 min 48 sec

Threads: 95 Questions: 160672130 Slow queries: 2410 Opens: 102274 Flush tables: 2 Open tables: 400 Queries per second avg: 7.857
————–


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *