©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The CONNECTION_ID SQL Function in MySQL and MariaDB - Connection ID of session

CONNECTION_IDSyntax:CONNECTION_ID()
Return value:INTEGER
Function type:Information function
Function Description

The CONNECTION_ID() function returns the connection ID for the current connection (session).

Each connection has an ID that is unique among currently connected clients. This also applies to events.

Example

 1
 2
 3

SELECT connection_id();

connection_id()
int(10)
204
The examples were created with the MyWAY SQL manager: Download

How to use the CONNECTION_ID() function in MySQL and MariaDB databases

In MySQL and MariaDB the CONNECTION_ID() function is used to get the unique identifier that the assigned to the current client connection (session). The function returns an integer value representing the connection ID assigned to each client connection by the database server. The function requires no arguments and can be used directly in SQL statements or within SQL queries.

Each client connection is assigned a unique connection ID, which is used to distinguish and manage connections within the database server. The connection ID can be used for tracking and monitoring purposes, for example, logging connection activity, monitoring, or identifying long-running queries related to specific connections. Additionally, the connection ID can be used in combination with custom functions or procedures to implement custom access control or perform specific actions based on the client connection.
The connection ID is only available for the current session and does not persist across different sessions or server restarts.
COMPRESSCONCATCONCAT_WSCONNECTION_IDCONVCONVERTCONVERT_TZ

Further MySQL und MariaDB SQL Information functions

BENCHMARKBENCHMARK(Number, Expression)
More about BENCHMARK Function

BINLOG_GTID_POSBINLOG_GTID_POS()

CHARSETCHARSET(String)
More about CHARSET Function

COERCIBILITYCOERCIBILITY(String)
More about COERCIBILITY Function

COLLATIONCOLLATION(String)
More about COLLATION Function

CURRENT_USERCURRENT_USER()
More about CURRENT_USER Function

CURRENT_ROLECURRENT_ROLE()
More about CURRENT_ROLE Function

DATABASEDATABASE()
More about DATABASE Function

DECODE_HISTOGRAMDECODE_HISTOGRAM()

DEFAULTDEFAULT(Column)
More about DEFAULT Function

FOUND_ROWSFOUND_ROWS()
More about FOUND_ROWS Function

LAST_INSERT_IDLAST_INSERT_ID([Expression])
More about LAST_INSERT_ID Function

LAST_VALUELAST_VALUE(Expression [, Expression ...])
More about LAST_VALUE Function

ROWNUMROWNUM()

ROW_COUNTROW_COUNT()
More about ROW_COUNT Function

SCHEMASCHEMA()
More about SCHEMA Function

SESSION_USERSESSION_USER()
More about SESSION_USER Function

SYSTEM_USERSYSTEM_USER()
More about SYSTEM_USER Function

USERUSER()
More about USER Function

VERSIONVERSION()
More about VERSION Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the CONNECTION_ID SQL function: mysql.com and mariadb.com
Updated: 2023-09-17ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer