MySQL CONNECTION_ID() Function
The MySQL CONNECTION_ID()
function returns the unique connection ID of the current connection. MySQL assigns a unique ID for each connection.
CONNECTION_ID()
Syntax
Here is the syntax of the MySQL CONNECTION_ID()
function:
CONNECTION_ID()
Parameters
The MySQL CONNECTION_ID()
function does not require any parameters.
Return value
The CONNECTION_ID()
function returns the unique connection ID of the current connection.
CONNECTION_ID()
Examples
The following example shows how to use the CONNECTION_ID()
function to get the current connection’s unique connection ID.
SELECT CONNECTION_ID();
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 15 |
+-----------------+