Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



MySQL - What is my ...
 
Share:
Notifications
Clear all

[Solved] MySQL - What is my thread or connection ID?

1 Posts
1 Users
0 Likes
1,840 Views
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2675
Topic starter  

Sometimes a query can go haywire, often I do recognize which of the connections/processes is mine based on the SQL statement that is running, but sometimes it can be hard for example when my query triggers a trigger - in which case the SQL might not match my original query. In those cases I need the connection ID. With a simple SQL statement this can be retrieved:

CONNECTION_ID()

The returns the connection ID (thread ID) for the connection. Every connection has an ID that is unique among the set of currently connected clients.

mysql> SELECT CONNECTION_ID();
-> 23786


   
ReplyQuote
Share: