# mysql\_options

## Syntax

```c
int mysql_options(MYSQL * mysql,
                  enum mysql_option,
                  const void * arg);
```

* `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).
* `mysql_option` - the option you want to set. See description below.
* `arg` - the value for the option.

## Description

Used to set extra connect options and affect behavior for a connection. This function may be called multiple times to set several options. mysql\_options() should be called after [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md) and before [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md).

Returns zero on success, non zero if an error occurred (invalid option or value).

{% hint style="warning" %}
This function is deprecated as of MariaDB Connector/C 3.0 and will be removed in future releases. It's preferable to use [mysql\_optionsv](/docs/connectors/mariadb-connector-c/api-functions/mysql_optionsv.md).
{% endhint %}

### Options

See [mysql\_optionsv](/docs/connectors/mariadb-connector-c/api-functions/mysql_optionsv.md).

## See also

* [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md)
* [mysql\_optionsv](/docs/connectors/mariadb-connector-c/api-functions/mysql_optionsv.md)
* [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md)

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_options.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
