mysql\_thread\_id(3) MariaDB Connector/C mysql\_thread\_id(3)

## [Name](#Name)

mysql\_thread\_id - Returns id of the current connection

## [Synopsis](#Synopsis)

```
#include <mysql.h>
unsigned long mysql_thread_id(MYSQL * mysql);
    
```

## [Description](#Description)

The mysql\_thread\_id() function returns the thread id for the current connection.

## [Parameter](#Parameter)

•

mysql - a mysql handle, which was previously allocated by [**mysql\_init(3)**](/man/enterprise-packages/mariadb-10.6/mysql_init.3) and connected by [**mysql\_real\_connect(3)**](/man/enterprise-packages/mariadb-10.6/mysql_real_connect.3). ### Notes

•

The current connection can be killed with [**mysql\_kill(3)**](/man/enterprise-packages/mariadb-10.6/mysql_kill.3).

•

If reconnect option is enabled the thread id might change if the client reconnects to the server.

## [Return value](#Return_value)

Returns the thread id of the current connection.

## [See also](#See_also)

•

[**mysql\_kill(3)**](/man/enterprise-packages/mariadb-10.6/mysql_kill.3)

•

[**mysql\_options(3)**](/man/enterprise-packages/mariadb-10.6/mysql_options.3)

Version 3.3

---

Document: mysql_thread_id(3) from mariadb-10.6 10.6.28-r4 (Chainguard OS)
Source: https://github.com/MariaDB/server.git
