MySQL CONNECTION_ID() Function
The MySQL CONNECTION_ID() function returns the unique connection ID for the current connection. Each connection in MySQL database has a connection ID that is unique among the currently connected clients.
Syntax
CONNECTION_ID()
Parameters
No parameter is required.
Return Value
Returns the unique connection ID for the current connection.
Example:
The example below shows the usage of CONNECTION_ID() function.
mysql> SELECT CONNECTION_ID();
The above query will return the unique connection ID for the current connection and the output of the above query will be similar to:
mysql> SELECT CONNECTION_ID(); Result: 943851
In this case, the unique connection ID is 943851.
❮ MySQL Functions