Skip to content
Related Articles

Related Articles

MySQL | CONNECTION_ID( ) Function
  • Last Updated : 25 Nov, 2019

The MySQL CONNECTION_ID() function is used for return the connection ID for a current connection in MySQL. The connection ID used to establish a connection to a database is unique for every connection among the connected clients. The CONNECTION_ID() function does not require any parameters or arguments.

The value returned by the CONNECTION_ID() function is the same type of value as displayed in the ID column of the INFORMATION_SCHEMA.PROCESSLIST table.

Syntax:

CONNECTION_ID()

Parameters Used:
The CONNECTION_ID() function does not require any parameters or arguments.

Return Value:
The MySQL CONNECTION_ID() function returns an integer value which represents the unique current connection ID.



Supported Versions of MySQL:

  • MySQL 5.7
  • MySQL 5.6
  • MySQL 5.5
  • MySQL 5.1
  • MySQL 5.0
  • MySQL 4.1
  • MySQL 4.0
  • MySQL 3.23

Example: Implementing CONNECTION_ID() function.

SELECT CONNECTION_ID(); 

Output:

1196078 

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :