LoginSignup
0
0

DBに接続しているコネクションの接続元を調べる。

Posted at

仕事上でコネクションの調査をした時のメモ

以下のようなSQLで調べられる。。今まで知らなかった。

SELECT * FROM information_schema.PROCESSLIST where host = 'localhost';
+-----------+----------+-----------+------+---------+------+-----------+-----------------------------------------------------------------------+
| ID        | USER     | HOST      | DB   | COMMAND | TIME | STATE     | INFO                                                                  |
+-----------+----------+-----------+------+---------+------+-----------+-----------------------------------------------------------------------+
| 168731364 | user | localhost | hoge | Query   |    0 | executing | SELECT * FROM information_schema.PROCESSLIST where host = 'localhost' |
+-----------+----------+-----------+------+---------+------+-----------+-----------------------------------------------------------------------+
1 row in set (0.01 sec)

show processlistコマンドでも調べられるが、絞り込めないので、上記の方が便利

0
0
0

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
0
0