mariadb\_reconnect(3) MariaDB Connector/C mariadb\_reconnect(3)

## [Name](#Name)

mariadb\_reconnect - reconnects to a server

## [Synopsis](#Synopsis)

```
#include <mysql.h>
my_bool  mariadb_reconnect(MYSQL * mysql)
    
```

## [Description](#Description)

mariadb\_reconnect() tries to reconnect to a server in case the connection died due to timeout or other errors. It uses the same credentials which were specified in [**mysql\_real\_connect(3)**](/man/os/mariadb-12.3/mysql_real_connect.3).

## [Return value](#Return_value)

The function will return 0 on success, a non zero value on error

**Note**: The function will return an error, if the option MYSQL\_OPT\_RECONNECT wasn’t set before.

## [History](#History)

mariadb\_reconnect() was added in MariaDB Connector/C 3.0

## [See also](#See_also)

•

[**mysql\_real\_connect(3)**](/man/os/mariadb-12.3/mysql_real_connect.3)

•

[**mysql\_optionsv(3)**](/man/os/mariadb-12.3/mysql_optionsv.3)

Version 3.4

---

Document: mariadb_reconnect(3) from mariadb-12.3 12.3.3-r2 (Chainguard OS)
Source: https://github.com/MariaDB/server.git
