> 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_options4.md).

# mysql\_options4

## Syntax

```bnf
#include <mysql.h>

int mysql_options4(MYSQL *mysql,
                   enum mysql_option option,
                   const void *arg1,
                   const void *arg2);
```

## Parameters

| Parameter | Description                                                                                                                                                                                                                                              |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mysql`   | A connection handle previously allocated by [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md). Must be called before [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md). |
| `option`  | The option to set.                                                                                                                                                                                                                                       |
| `arg1`    | The first value for the option.                                                                                                                                                                                                                          |
| `arg2`    | The second value for the option.                                                                                                                                                                                                                         |

## Description

`mysql_options4` is used to set extra connect options and affect behavior for a connection. This function may be called multiple times to set several options. It must be called after `mysql_init()` and before `mysql_real_connect()`.

## Return Value

Returns zero on success, non-zero if the option is unknown or the value is invalid.

## Options

An overview of the possible options can be found in the description of the [`mysql_optionsv()`](/docs/connectors/mariadb-connector-c/api-functions/mysql_optionsv.md) API function.

{% hint style="info" %}
This function is deprecated, new implementations should use [`mysql_optionsv()`](/docs/connectors/mariadb-connector-c/api-functions/mysql_optionsv.md) api function instead.
{% endhint %}

## See Also

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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_options4.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.
