This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-14. For the latest, interactive version please visit https://mariadb.com/kb/.

mysql_thread_id

Syntax

unsigned long mysql_thread_id(MYSQL * mysql);

Description

The mysql_thread_id() function returns the thread id for the current connection.

The current connection can be killed with mysql_kill(). If reconnect option is enabled the thread id might change if the client reconnects to the server.

Note that connector will return only the first 32bits value. If your database might expect to create more than 4.3 billion connection without a restart, it's better to query 'select CONNECTION_ID()'

See also

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.