日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql+查看connection_如何查看MySQL connection id连接id

發布時間:2025/3/15 数据库 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql+查看connection_如何查看MySQL connection id连接id 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

每個MySQL連接,都有一個連接ID,可以通過 connection_id()查看。

連接id也可以通過以下方式查看:

show processlist中id列

information_schema.processlist的id列

performance_schema.threads的processlist_id 列

下面通過具體命令查看連接id。

查看連接id:

mysql> select connection_id();

+—————–+

| connection_id() |

+—————–+

| 15 |

+—————–+

1 row in set (0.00 sec)

1

2

3

4

5

6

7

8

查看show processlist:

mysql> show processlist;

+—-+——+—————–+——+———+——+———-+——————+

| Id | User | Host | db | Command | Time | State | Info |

+—-+——+—————–+——+———+——+———-+——————+

| 3 | root | localhost:60989 | cmdb | Sleep | 318 | | NULL |

| 4 | root | localhost:60990 | cmdb | Sleep | 318 | | NULL |

| 15 | root | localhost | NULL | Query | 0 | starting | show processlist |

+—-+——+—————–+——+———+——+———-+——————+

3 rows in set (0.00 sec)

1

2

3

4

5

6

7

8

9

查看數據表information_schema.processlist:

mysql> select * from information_schema.processlist;

+—-+——+—————–+——+———+——+———–+———————————————–+

| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |

+—-+——+—————–+——+———+——+———–+———————————————–+

| 3 | root | localhost:60989 | cmdb | Sleep | 157 | | NULL |

| 15 | root | localhost | NULL | Query | 0 | executing | select * from INFORMATION_SCHEMA.PROCESSLIST |

| 4 | root | localhost:60990 | cmdb | Sleep | 157 | | NULL |

+—-+——+—————–+——+———+——+———–+———————————————–+

3 rows in set (0.00 sec)

1

2

3

4

5

6

7

8

9

查看數據表performance_schema.threads:

mysql> select thread_id, name, processlist_id from performance_schema.threads;

+———–+—————————————-+—————-+

| thread_id | name | processlist_id |

+———–+—————————————-+—————-+

| 1 | thread/sql/main | NULL |

| 2 | thread/sql/thread_timer_notifier | NULL |

| 3 | thread/innodb/io_ibuf_thread | NULL |

| 4 | thread/innodb/io_log_thread | NULL |

| 5 | thread/innodb/io_read_thread | NULL |

| 6 | thread/innodb/io_read_thread | NULL |

| 7 | thread/innodb/io_read_thread | NULL |

| 8 | thread/innodb/io_read_thread | NULL |

| 9 | thread/innodb/io_write_thread | NULL |

| 10 | thread/innodb/io_write_thread | NULL |

| 11 | thread/innodb/io_write_thread | NULL |

| 12 | thread/innodb/io_write_thread | NULL |

| 13 | thread/innodb/page_cleaner_thread | NULL |

| 16 | thread/innodb/srv_lock_timeout_thread | NULL |

| 15 | thread/innodb/srv_error_monitor_thread | NULL |

| 17 | thread/innodb/srv_monitor_thread | NULL |

| 18 | thread/innodb/srv_master_thread | NULL |

| 19 | thread/innodb/srv_worker_thread | NULL |

| 20 | thread/innodb/srv_worker_thread | NULL |

| 21 | thread/innodb/srv_purge_thread | NULL |

| 22 | thread/innodb/srv_worker_thread | NULL |

| 23 | thread/innodb/buf_dump_thread | NULL |

| 24 | thread/innodb/dict_stats_thread | NULL |

| 25 | thread/sql/signal_handler | NULL |

| 26 | thread/sql/compress_gtid_table | 1 |

| 28 | thread/sql/one_connection | 3 |

| 29 | thread/sql/one_connection | 4 |

| 40 | thread/sql/one_connection | 15 |

+———–+—————————————-+—————-+

28 rows in set (0.00 sec)

————————————————

總結

以上是生活随笔為你收集整理的mysql+查看connection_如何查看MySQL connection id连接id的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。