# mysql\_errno

## Syntax

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

* `mysql` - a mysql handle, which was previously allocated by [mysql\_init()](mysql_init) or [mysql\_real\_connect()](mysql_real_connect).

## Description

Returns the last [error code](https://app.gitbook.com/s/SsmexDFPv2xG2OTyO5yV/reference/error-codes) 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()](mysql_error)
* [mysql\_sqlstate()](mysql_sqlstate)

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