---
name: "mysql_thread_init"
section: "3"
platform: "linux"
package: "mariadb"
version: "13.0.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mysql_thread_init"
---

# mysql\_thread\_init(3)

### Name

mysql\_thread\_init - initialize thread

### Synopsis

-

  ```
  #include <mysql.h>
  my_bool mysql_thread_init(void );
  ```

### Description

Thread initialization for multi threaded clients. Multi threaded clients should call mysql\_thread\_init() at the beginning of the thread initialization to initialize thread specific client library variables. If mysql\_thread\_init() was not called explicitly, it will be called automatically by **[mysql\_init(3)](/mysql_init/3.md)** or **[mysql\_real\_connect(3)](/mysql_real_connect/3.md)**.

### Notes

Before a client thread ends the **[mysql\_thread\_end(3)](/mysql_thread_end/3.md)** function must be called to release memory - otherwise the client library will report an error.

### Return value

Returns zero if successful or 1 if an error occurred.

### History

This function is deprecated since MariaDB Connector/C 3.0.0.

### See also

- •

  **[mysql\_thread\_end(3)](/mysql_thread_end/3.md)**

- •

  **mysql\_thread\_safe(3)**
