> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_errno.md).

# mysql\_errno

## Syntax

```c
unsigned int mysql_errno(MYSQL * mysql);
```

## Parameter

* `mysql` - a mysql handle, which was previously allocated by [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md) or [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md).

## Description

Returns the last [error code](/docs/server/reference/error-codes.md) for the most recent function call that can succeed or fail. Zero means no error occurred.

{% hint style="info" %}
Client error messages are listed in errmsg.h header file, server error messages are listed in mysqld\_error.h header file of the server source distribution.
{% endhint %}

## See Also

* [mysql\_error()](/docs/connectors/mariadb-connector-c/api-functions/mysql_error.md)
* [mysql\_sqlstate()](/docs/connectors/mariadb-connector-c/api-functions/mysql_sqlstate.md)

{% @marketo/form formId="4316" %}
