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, 755🔥, 0💬
Popular Posts:
What Happens If the UPDATE Subquery Returns Multiple Rows in MySQL? If a subquery is used in a UPDAT...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
How To Install Oracle Database 10g XE in Oracle? To install 10g universal edition, double click, Ora...
Where to find reference information and tutorials on MySQL database functions? I want to know how to...