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

## [Name](#Name)

mysql\_error - returns the last error message for the most recent function call

## [Synopsis](#Synopsis)

```
#include <mysql.h>
const char * mysql_error(MYSQL * mysql);
    
```

## [Description](#Description)

Returns the last error message for the most recent function call that can succeed or fail. An empty string means no error occurred.

## [Parameter](#Parameter)

•

mysql is a connection identifier, which was previously allocated by [**mysql\_init(3)**](/man/enterprise-packages/mariadb-10.11/mysql_init.3) and connected by [**mysql\_real\_connect(3)**](/man/enterprise-packages/mariadb-10.11/mysql_real_connect.3).

## [Notes](#Notes)

•

Client error codes are listed in errmsg.h header file, server error codes are listed in mysqld\_error.h header file of the server source distribution.

•

Client error messages can be obtained by calling [**mariadb\_get\_infov(3)**](/man/enterprise-packages/mariadb-10.11/mariadb_get_infov.3) and passing the parameter MARIADB\_CLIENT\_ERRORS

## [See also](#See_also)

•

[**mysql\_errno(3)**](/man/enterprise-packages/mariadb-10.11/mysql_errno.3)

•

[**mysql\_sqlstate(3)**](/man/enterprise-packages/mariadb-10.11/mysql_sqlstate.3)

Version 3.3

---

Document: mysql_error(3) from mariadb-10.11 10.11.19-r5 (Chainguard OS)
Source: https://github.com/MariaDB/server.git
