“获取MySQL版本号、连接数”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) |
Jihongchang(讨论 | 贡献) |
||
第13行: | 第13行: | ||
</syntaxhighlight>查看 MySQL 支持的最大连接数<syntaxhighlight lang="sql"> | </syntaxhighlight>查看 MySQL 支持的最大连接数<syntaxhighlight lang="sql"> | ||
SHOW VARIABLES LIKE 'max_connections'; | SHOW VARIABLES LIKE 'max_connections'; | ||
+ | </syntaxhighlight>查看当前连接 MySQL 的客户端<syntaxhighlight lang="sql"> | ||
+ | select distinct(regexp_substr(host, '(\\d+\\.)+\\d+')) | ||
+ | from information_schema.processlist; | ||
</syntaxhighlight> | </syntaxhighlight> |
2024年11月27日 (三) 01:59的最新版本
version()函数返回数据库的版本号
select version();
查看当前连接数
show status like '%Threads_connected%';
查看当前连接
select *
from information_schema.processlist;
查看 MySQL 支持的最大连接数
SHOW VARIABLES LIKE 'max_connections';
查看当前连接 MySQL 的客户端
select distinct(regexp_substr(host, '(\\d+\\.)+\\d+'))
from information_schema.processlist;