mysql\_init(3) MariaDB Connector/C mysql\_init(3)

## [Name](#Name)

mysql\_init - Prepares and initializes a MYSQL structure

## [Synopsis](#Synopsis)

```
#include <mysql.h>
MYSQL *mysql_init(MYSQL *mysql);
    
```

## [Description](#Description)

Prepares and initializes a MYSQL structure to be used with [**mysql\_real\_connect(3)**](/man/enterprise-packages/mariadb-10.6/mysql_real_connect.3). If an address of a MYSQL structure was passed as parameter, the structure will be initialized, if NULL was passed, a new structure will be allocated and initialized.

**Notes:** * If parameter mysql is not NULL [**mysql\_close(3)**](/man/enterprise-packages/mariadb-10.6/mysql_close.3) API function will not release the memory * Any subsequent calls to any function (except [**mysql\_optionsv(3)**](/man/enterprise-packages/mariadb-10.6/mysql_optionsv.3) will fail until [**mysql\_real\_connect(3)**](/man/enterprise-packages/mariadb-10.6/mysql_real_connect.3) was called. * Memory allocated by mysql\_init() must be freed with [**mysql\_close(3)**](/man/enterprise-packages/mariadb-10.6/mysql_close.3).

## [Return value](#Return_value)

The mysql\_init() function returns an address of a MYSQL structure, or NULL in case of memory allcation error.

## [See also](#See_also)

•

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

•

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

Version 3.3

---

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