Collections:
CONNECTION_ID() - Thread ID of Current Connection
How to obtain the connection ID of the current connection using the CONNECTION_ID() function?
✍: FYIcenter.com
CONNECTION_ID() is a MySQL built-in function that
returns the connection ID of the current connection.
The connection ID is also referred as thread ID or process ID.
For example:
SELECT CONNECTION_ID(); -- +-----------------+ -- | CONNECTION_ID() | -- +-----------------+ -- | 307 | -- +-----------------+ SHOW PROCESSLIST; -- +-----+-----------------+-----------------+------+---------+---------+------------------------+------------------+ -- | Id | User | Host | db | Command | Time | State | Info | -- +-----+-----------------+-----------------+------+---------+---------+------------------------+------------------+ -- | 4 | event_scheduler | localhost | NULL | Daemon | 1061875 | Waiting on empty queue | NULL | -- | 307 | root | localhost:52427 | test | Query | 0 | starting | show processlist | -- +-----+-----------------+-----------------+------+---------+---------+------------------------+------------------+
Reference information of the CONNECTION_ID() function:
CONNECTION_ID(): con Returns the connection ID of the current connection. Arguments, return value and availability: con: Return value. The connection ID. Available since MySQL 4.0.
⇒ CURRENT_ROLE() - Current Role of Logged-In User
⇐ BENCHMARK() - Repeating Expression Evaluation
2024-07-15, 2103🔥, 0💬
Popular Posts:
How to calculate the storage size of a JSON (JavaScript Object Notation) value using the JSON_STORAG...
How to download Microsoft SQL Server 2005 Express Edition in SQL Server? Microsoft SQL Server 2005 E...
What Is Transport Network Substrate (TNS) in Oracle? TNS, Transport Network Substrate, is a foundati...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL? When you enter DATETIM...