mysql檢視當前實時連線數

2021-10-07 01:11:24 字數 1120 閱讀 6650

靜態檢視:

show processlist;  

show full processlist;

show variables like '%max_connections%';

show status like '%connection%';

實時檢視:

mysql> show status like 'threads%';  

+-------------------+-------+

| variable_name | value |

+-------------------+-------+

| threads_cached | 58 |

| threads_connected | 57 | ###這個數值指的是開啟的連線數

| threads_created | 3676 | ###threads_created表示建立過的執行緒數,如果發現threads_created值過大的話,表明mysql伺服器一直在建立執行緒,這也是比較耗資源

| threads_running | 4 | ###這個數值指的是啟用的連線數,這個數值一般遠低於connected數值

+-------------------+-------+

threads_connected 跟show processlist結果相同,表示當前連線數。準確的來說,threads_running是代表當前併發數

這是是查詢資料庫當前設定的最大連線數

mysql> show variables like '%max_connections%';

+-----------------+-------+

| variable_name | value |

+-----------------+-------+

| max_connections | 100 |

+-----------------+-------+

可以在/etc/my.cnf裡面設定資料庫的最大連線數

max_connections = 1000

檢視mysql和pgsql當前實時連線數

靜態檢視 show processlist show full processlist show variables like max connections show status like connection 實時檢視 mysql show status like threads variab...

mysql 檢視當前連線數

文章 本語句報告tcp ip連線的主機名稱 採用host name client port格式 以方便地判定哪個客戶端正在做什麼。如果您得到 too many connections 錯誤資訊,並且想要了解正在發生的情況,本語句是非常有用的。mysql保留乙個額外的連線,讓擁有super許可權的 賬...

mysql 檢視當前連線數

命令 show processlist 如果是root帳號,你能看到所有使用者的當前連線。如果是其它普通帳號,只能看到自己占用的連線。show processlist 只列出前100條,如果想全列出請使用show full processlist mysql show processlist 命令 ...