LoginSignup
16

More than 5 years have passed since last update.

MySQLの接続数や起動プロセスを確認するコマンド

Last updated at Posted at 2018-05-22

DBへの接続数を調査した際のまとめです。
数値は凡例です。

最大接続数設定

コマンド

mysql > show global variables like 'max_connections';

結果

Variable_name Value
max_connections 66

DBが起動してからこれまでの累積接続数

コマンド

mysql > show global status like 'Connections';

結果

Variable_name Value
Connections 569611

DBが起動してからこれまでの最大同時接続数

コマンド

mysql > show global status like 'Max_used_connections';

結果

Variable_name Value
Max_used_connections 14

Threads 関連ステータス

コマンド

mysql > show global status like 'Thread_%';

結果

Variable_name Value 意味
Threads_cached 6 キャッシュされたスレッド数
Threads_connected 3 現在の接続数
Threads_created 503 生成されたスレッド数
Threads_running 1 実行中のスレッド数

起動中のプロセス

コマンド

mysql > show full processlist;

結果

Id User Host db Command Time State Info
42916 rdsadmin localhost:29736 mysql Sleep 1 NULL
569581 uralogical hogefuga.tokyff01.ap.so-net.ne.jp:xxxxx uralogicaldb Query 0 starting show full processlist
569582 uralogical hogefuga.tokyff01.ap.so-net.ne.jp:xxxxx NULL Sleep 11 NULL

プロセスの終了

コマンド

mysql > KILL processlist_id;

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16