“获取MySQL版本号、连接数”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
(建立内容为“version()函数返回数据库的版本号<syntaxhighlight lang="sql"> select version(); </syntaxhighlight> 查看当前连接<syntaxhighlight lang="sql"> sele…”的新页面)
 
 
(未显示同一用户的2个中间版本)
第3行: 第3行:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
查看当前连接数<syntaxhighlight lang="sql">
 +
show status like '%Threads_connected%';
 +
</syntaxhighlight>
  
  
 
查看当前连接<syntaxhighlight lang="sql">
 
查看当前连接<syntaxhighlight lang="sql">
 
select *
 
select *
 +
from information_schema.processlist;
 +
</syntaxhighlight>查看 MySQL 支持的最大连接数<syntaxhighlight lang="sql">
 +
SHOW VARIABLES LIKE 'max_connections';
 +
</syntaxhighlight>查看当前连接 MySQL 的客户端<syntaxhighlight lang="sql">
 +
select distinct(regexp_substr(host, '(\\d+\\.)+\\d+'))
 
from information_schema.processlist;
 
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;