Open In App

MySQL | CONNECTION_ID( ) Function

Last Updated : 25 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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 

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads