You are here : cpp0mysql_options

mysql_options() - 0

 Can be used to set extra connect options and affect behavior for
        a connection. This function may be called multiple times to set
        several options. (To retrieve option values, use
        mysql_get_option().)mysql_get_option()mysql_get_option()Call mysql_options() after
        mysql_init() and before
        mysql_connect() or
        mysql_real_connect().mysql_options()mysql_options()mysql_init()mysql_init()mysql_connect()mysql_connect()mysql_real_connect()mysql_real_connect()The option argument is the option that you
        want to set; the arg argument is the value
        for the option. If the option is an integer, specify a pointer
        to the value of the integer as the arg
        argument.optionargargThe following list describes the possible options, their effect,
        and how arg is used for each option. Several
        of the options apply only when the application is linked against
        the libmysqld embedded server library and are
        unused for applications linked against the
        libmysqlclient client library. For option
        descriptions that indicate arg is unused, its
        value is irrelevant; it is conventional to pass 0.arglibmysqldlibmysqlclientargMYSQL_DEFAULT_AUTH (argument type:
            char *)
          
            The name of the authentication plugin to use.
          
MYSQL_ENABLE_CLEARTEXT_PLUGIN (argument
            type: my_bool *)
          
            Enable the mysql_clear_password cleartext
            authentication plugin. (See
            Section 7.5.1.8, “The Cleartext Client-Side Authentication Plugin”.)
          
MYSQL_INIT_COMMAND (argument type:
            char *)
          
            SQL statement to execute when connecting to the MySQL
            server. Automatically re-executed if reconnection occurs.
          
MYSQL_OPT_BIND (argument: char
            *)
          
            The network interface from which to connect to the server.
            This is used when the client host has multiple network
            interfaces. The argument is a host name or IP address
            (specified as a string).
          
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
            (argument type: my_bool *)
          
            Indicate whether the client can handle expired passwords.
            For more information, see
            Section 7.3.7, “Password Expiration and Sandbox Mode”.
          
MYSQL_OPT_COMPRESS (argument: not used)
          
            Use the compressed client/server protocol.
          
MYSQL_OPT_CONNECT_ATTR_DELETE (argument
            type: char *)
          
            Given a key name, this option deletes a key/value pair from
            the current set of connection attributes to pass to the
            server at connect time. The argument is a pointer to a
            null-terminated string naming the key. Comparison of the key
            name with existing keys is case sensitive.
          
            See also the description for the
            MYSQL_OPT_CONNECT_ATTR_RESET option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.
          
            The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.
          
MYSQL_OPT_CONNECT_ATTR_RESET (argument
            not used)
          
            This option resets (clears) the current set of connection
            attributes to pass to the server at connect time.
          
            See also the description for the
            MYSQL_OPT_CONNECT_ATTR_DELETE option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.
          
            The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.
          
MYSQL_OPT_CONNECT_TIMEOUT (argument type:
            unsigned int *)
          
            The connect timeout in seconds.
          
MYSQL_OPT_GUESS_CONNECTION (argument: not
            used)
          
            For an application linked against the
            libmysqld embedded server library, this
            enables the library to guess whether to use the embedded
            server or a remote server. “Guess” means that
            if the host name is set and is not
            localhost, it uses a remote server. This
            behavior is the default.
            MYSQL_OPT_USE_EMBEDDED_CONNECTION and
            MYSQL_OPT_USE_REMOTE_CONNECTION can be
            used to override it. This option is ignored for applications
            linked against the libmysqlclient client
            library.
          
MYSQL_OPT_LOCAL_INFILE (argument type:
            optional pointer to unsigned int)
          
            If no pointer is given or if pointer points to an
            unsigned int that has a nonzero value,
            the LOAD DATA
            LOCAL INFILE statement is enabled.
          
MYSQL_OPT_MAX_ALLOWED_PACKET (argument:
            unsigned long *)
          
            This option sets the
            max_allowed_packet system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.
          
MYSQL_OPT_NAMED_PIPE (argument: not used)
          
            Use a named pipe to connect to the MySQL server on Windows,
            if the server permits named-pipe connections.
          
MYSQL_OPT_NET_BUFFER_LENGTH (argument:
            unsigned long *)
          
            This option sets the
            net_buffer_length system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.
          
MYSQL_OPT_PROTOCOL (argument type:
            unsigned int *)
          
            Type of protocol to use. Specify one of the enum values of
            mysql_protocol_type defined in
            mysql.h.
          
MYSQL_OPT_READ_TIMEOUT (argument type:
            unsigned int *)
          
            The timeout in seconds for each attempt to read from the
            server. There are retries if necessary, so the total
            effective timeout value is three times the option value. You
            can set the value so that a lost connection can be detected
            earlier than the TCP/IP
            Close_Wait_Timeout value of 10 minutes.
          
MYSQL_OPT_RECONNECT (argument type:
            my_bool *)
          
            Enable or disable automatic reconnection to the server if
            the connection is found to have been lost. Reconnect is off
            by default; this option provides a way to set reconnection
            behavior explicitly.
          
MYSQL_OPT_RETRY_COUNT (argument type:
            unsigned int *)
          
            The retry count for I/O-related system calls that are
            interrupted while connecting to the server or communicating
            with it. The default value is 1 (1 retry if the initial call
            is interrupted for 2 tries total).
          
            This option can be used only by clients that link against a
            C client library compiiled with MySQL Cluster support. It is
            available as of MySQL Cluster 7.5.1.
          
MYSQL_OPT_SSL_CA (argument type:
            char *)
          
            The path to a file in PEM format that contains a list of
            trusted SSL CAs.
          
MYSQL_OPT_SSL_CAPATH (argument type:
            char *)
          
            The path to a directory that contains trusted SSL CA
            certificates in PEM format.
          
MYSQL_OPT_SSL_CERT (argument type:
            char *)
          
            The name of an SSL certificate file in PEM format to use for
            establishing a secure connection.
          
MYSQL_OPT_SSL_CIPHER (argument type:
            char *)
          
            A list of permissible ciphers to use for SSL encryption.
          
MYSQL_OPT_SSL_CRL (argument type:
            char *)
          
            The path to a file containing certificate revocation lists
            in PEM format.
          
MYSQL_OPT_SSL_CRLPATH (argument type:
            char *)
          
            The path to a directory that contains files containing
            certificate revocation lists in PEM format.
          
MYSQL_OPT_SSL_ENFORCE (argument type:
            my_bool *)
          
            Whether to require the connection to use SSL. If enabled and
            an encrypted connection cannot be established, the
            connection attempt fails. This option was added in MySQL
            5.7.3.
          
            This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_REQUIRED.
          
MYSQL_OPT_SSL_KEY (argument type:
            char *)
          
            The name of an SSL key file in PEM format to use for
            establishing a secure connection.
          
MYSQL_OPT_SSL_MODE (argument type:
            unsigned int *)
          
            The security state to use for the connection to the server:
            SSL_MODE_DISABLED,
            SSL_MODE_PREFERRED,
            SSL_MODE_REQUIRED,
            SSL_MODE_VERIFY_CA,
            SSL_MODE_VERIFY_IDENTITY. The default is
            SSL_MODE_PREFERRED. These modes are the
            permitted values of the mysql_ssl_mode
            enumeration defined in mysql.h. For
            more information about the security modes, see the
            description of --ssl-mode in
            Section 7.4.5, “Command Options for Secure Connections”.
          
            This option was added in MySQL 5.7.11.
          
MYSQL_OPT_SSL_VERIFY_SERVER_CERT
            (argument type: my_bool *)
          
            Enable or disable verification of the server's Common Name
            value in its certificate against the host name used when
            connecting to the server. The connection is rejected if
            there is a mismatch. For encrypted connections, this feature
            can be used to prevent man-in-the-middle attacks.
            Verification is disabled by default.
          
            This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_VERIFY_IDENTITY.
          
MYSQL_OPT_TLS_VERSION (argument type:
            char *)
          
            The protocols permitted by the client for encrypted
            connections. The value is a comma-separated list containing
            one or more protocol names. The protocols that can be named
            for this option depend on the SSL library used to compile
            MySQL. For details, see
            Section 7.4.3, “Secure Connection Protocols and Ciphers”.
          
            This option was added in MySQL 5.7.10.
          
MYSQL_OPT_USE_EMBEDDED_CONNECTION
            (argument: not used)
          
            For an application linked against the
            libmysqld embedded server library, this
            forces the use of the embedded server for the connection.
            This option is ignored for applications linked against the
            libmysqlclient client library.
          
MYSQL_OPT_USE_REMOTE_CONNECTION
            (argument: not used)
          
            For an application linked against the
            libmysqld embedded server library, this
            forces the use of a remote server for the connection. This
            option is ignored for applications linked against the
            libmysqlclient client library.
          
MYSQL_OPT_USE_RESULT (argument: not used)
          
            This option is unused.
          
MYSQL_OPT_WRITE_TIMEOUT (argument type:
            unsigned int *)
          
            The timeout in seconds for each attempt to write to the
            server. There is a retry if necessary, so the total
            effective timeout value is two times the option value.
          
MYSQL_PLUGIN_DIR (argument type:
            char *)
          
            The directory in which to look for client plugins.
          
MYSQL_READ_DEFAULT_FILE (argument type:
            char *)
          
            Read options from the named option file instead of from
            my.cnf.
          
MYSQL_READ_DEFAULT_GROUP (argument type:
            char *)
          
            Read options from the named group from
            my.cnf or the file specified with
            MYSQL_READ_DEFAULT_FILE.
          
MYSQL_REPORT_DATA_TRUNCATION (argument
            type: my_bool *)
          
            Enable or disable reporting of data truncation errors for
            prepared statements using the error
            member of MYSQL_BIND structures.
            (Default: enabled.)
          
MYSQL_SECURE_AUTH (argument type:
            my_bool *)
          
            Whether to connect to a server that does not support the
            password hashing used in MySQL 4.1.1 and later. This option
            is enabled by default.
          
MYSQL_SERVER_PUBLIC_KEY (argument type:
            char *)
          
            The path name to a file containing the server RSA public
            key. The file must be in PEM format. The public key is used
            for RSA encryption of the client password for connections to
            the server made using accounts that authenticate with the
            sha256_password plugin. This option is
            ignored for client accounts that do not authenticate with
            that plugin. It is also ignored if password encryption is
            not needed, as is the case when the client connects to the
            server using an SSL connection.
          
            The server sends the public key to the client as needed, so
            it is not necessary to use this option for RSA password
            encryption to occur. It is more efficient to do so because
            then the server need not send the key.
          
            For additional discussion regarding use of the
            sha256_password plugin, including how to
            get the RSA public key, see
            Section 7.5.1.4, “The SHA-256 Authentication Plugin”.
          
MYSQL_SET_CHARSET_DIR (argument type:
            char *)
          
            The path name to the directory that contains character set
            definition files.
          
MYSQL_SET_CHARSET_NAME (argument type:
            char *)
          
            The name of the character set to use as the default
            character set. The argument can be
            MYSQL_AUTODETECT_CHARSET_NAME to cause
            the character set to be autodetected based on the operating
            system setting (see Section 11.1.5, “Connection Character Sets and Collations”).
          
MYSQL_SET_CLIENT_IP (argument type:
            char *)
          
            For an application linked against the
            libmysqld embedded server library (when
            libmysqld is compiled with authentication
            support), this means that the user is considered to have
            connected from the specified IP address (specified as a
            string) for authentication purposes. This option is ignored
            for applications linked against the
            libmysqlclient client library.
          
MYSQL_SHARED_MEMORY_BASE_NAME (argument
            type: char *)
          
            The name of the shared-memory object for communication to
            the server on Windows, if the server supports shared-memory
            connections. Specify the same value as the
            --shared-memory-base-name
            option used for the mysqld server you
            want to connect to.MYSQL_DEFAULT_AUTH (argument type:
            char *)
          
            The name of the authentication plugin to use.
          
MYSQL_ENABLE_CLEARTEXT_PLUGIN (argument
            type: my_bool *)
          
            Enable the mysql_clear_password cleartext
            authentication plugin. (See
            Section 7.5.1.8, “The Cleartext Client-Side Authentication Plugin”.)
          
MYSQL_INIT_COMMAND (argument type:
            char *)
          
            SQL statement to execute when connecting to the MySQL
            server. Automatically re-executed if reconnection occurs.
          
MYSQL_OPT_BIND (argument: char
            *)
          
            The network interface from which to connect to the server.
            This is used when the client host has multiple network
            interfaces. The argument is a host name or IP address
            (specified as a string).
          
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
            (argument type: my_bool *)
          
            Indicate whether the client can handle expired passwords.
            For more information, see
            Section 7.3.7, “Password Expiration and Sandbox Mode”.
          
MYSQL_OPT_COMPRESS (argument: not used)
          
            Use the compressed client/server protocol.
          
MYSQL_OPT_CONNECT_ATTR_DELETE (argument
            type: char *)
          
            Given a key name, this option deletes a key/value pair from
            the current set of connection attributes to pass to the
            server at connect time. The argument is a pointer to a
            null-terminated string naming the key. Comparison of the key
            name with existing keys is case sensitive.
          
            See also the description for the
            MYSQL_OPT_CONNECT_ATTR_RESET option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.
          
            The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.
          
MYSQL_OPT_CONNECT_ATTR_RESET (argument
            not used)
          
            This option resets (clears) the current set of connection
            attributes to pass to the server at connect time.
          
            See also the description for the
            MYSQL_OPT_CONNECT_ATTR_DELETE option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.
          
            The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.
          
MYSQL_OPT_CONNECT_TIMEOUT (argument type:
            unsigned int *)
          
            The connect timeout in seconds.
          
MYSQL_OPT_GUESS_CONNECTION (argument: not
            used)
          
            For an application linked against the
            libmysqld embedded server library, this
            enables the library to guess whether to use the embedded
            server or a remote server. “Guess” means that
            if the host name is set and is not
            localhost, it uses a remote server. This
            behavior is the default.
            MYSQL_OPT_USE_EMBEDDED_CONNECTION and
            MYSQL_OPT_USE_REMOTE_CONNECTION can be
            used to override it. This option is ignored for applications
            linked against the libmysqlclient client
            library.
          
MYSQL_OPT_LOCAL_INFILE (argument type:
            optional pointer to unsigned int)
          
            If no pointer is given or if pointer points to an
            unsigned int that has a nonzero value,
            the LOAD DATA
            LOCAL INFILE statement is enabled.
          
MYSQL_OPT_MAX_ALLOWED_PACKET (argument:
            unsigned long *)
          
            This option sets the
            max_allowed_packet system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.
          
MYSQL_OPT_NAMED_PIPE (argument: not used)
          
            Use a named pipe to connect to the MySQL server on Windows,
            if the server permits named-pipe connections.
          
MYSQL_OPT_NET_BUFFER_LENGTH (argument:
            unsigned long *)
          
            This option sets the
            net_buffer_length system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.
          
MYSQL_OPT_PROTOCOL (argument type:
            unsigned int *)
          
            Type of protocol to use. Specify one of the enum values of
            mysql_protocol_type defined in
            mysql.h.
          
MYSQL_OPT_READ_TIMEOUT (argument type:
            unsigned int *)
          
            The timeout in seconds for each attempt to read from the
            server. There are retries if necessary, so the total
            effective timeout value is three times the option value. You
            can set the value so that a lost connection can be detected
            earlier than the TCP/IP
            Close_Wait_Timeout value of 10 minutes.
          
MYSQL_OPT_RECONNECT (argument type:
            my_bool *)
          
            Enable or disable automatic reconnection to the server if
            the connection is found to have been lost. Reconnect is off
            by default; this option provides a way to set reconnection
            behavior explicitly.
          
MYSQL_OPT_RETRY_COUNT (argument type:
            unsigned int *)
          
            The retry count for I/O-related system calls that are
            interrupted while connecting to the server or communicating
            with it. The default value is 1 (1 retry if the initial call
            is interrupted for 2 tries total).
          
            This option can be used only by clients that link against a
            C client library compiiled with MySQL Cluster support. It is
            available as of MySQL Cluster 7.5.1.
          
MYSQL_OPT_SSL_CA (argument type:
            char *)
          
            The path to a file in PEM format that contains a list of
            trusted SSL CAs.
          
MYSQL_OPT_SSL_CAPATH (argument type:
            char *)
          
            The path to a directory that contains trusted SSL CA
            certificates in PEM format.
          
MYSQL_OPT_SSL_CERT (argument type:
            char *)
          
            The name of an SSL certificate file in PEM format to use for
            establishing a secure connection.
          
MYSQL_OPT_SSL_CIPHER (argument type:
            char *)
          
            A list of permissible ciphers to use for SSL encryption.
          
MYSQL_OPT_SSL_CRL (argument type:
            char *)
          
            The path to a file containing certificate revocation lists
            in PEM format.
          
MYSQL_OPT_SSL_CRLPATH (argument type:
            char *)
          
            The path to a directory that contains files containing
            certificate revocation lists in PEM format.
          
MYSQL_OPT_SSL_ENFORCE (argument type:
            my_bool *)
          
            Whether to require the connection to use SSL. If enabled and
            an encrypted connection cannot be established, the
            connection attempt fails. This option was added in MySQL
            5.7.3.
          
            This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_REQUIRED.
          
MYSQL_OPT_SSL_KEY (argument type:
            char *)
          
            The name of an SSL key file in PEM format to use for
            establishing a secure connection.
          
MYSQL_OPT_SSL_MODE (argument type:
            unsigned int *)
          
            The security state to use for the connection to the server:
            SSL_MODE_DISABLED,
            SSL_MODE_PREFERRED,
            SSL_MODE_REQUIRED,
            SSL_MODE_VERIFY_CA,
            SSL_MODE_VERIFY_IDENTITY. The default is
            SSL_MODE_PREFERRED. These modes are the
            permitted values of the mysql_ssl_mode
            enumeration defined in mysql.h. For
            more information about the security modes, see the
            description of --ssl-mode in
            Section 7.4.5, “Command Options for Secure Connections”.
          
            This option was added in MySQL 5.7.11.
          
MYSQL_OPT_SSL_VERIFY_SERVER_CERT
            (argument type: my_bool *)
          
            Enable or disable verification of the server's Common Name
            value in its certificate against the host name used when
            connecting to the server. The connection is rejected if
            there is a mismatch. For encrypted connections, this feature
            can be used to prevent man-in-the-middle attacks.
            Verification is disabled by default.
          
            This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_VERIFY_IDENTITY.
          
MYSQL_OPT_TLS_VERSION (argument type:
            char *)
          
            The protocols permitted by the client for encrypted
            connections. The value is a comma-separated list containing
            one or more protocol names. The protocols that can be named
            for this option depend on the SSL library used to compile
            MySQL. For details, see
            Section 7.4.3, “Secure Connection Protocols and Ciphers”.
          
            This option was added in MySQL 5.7.10.
          
MYSQL_OPT_USE_EMBEDDED_CONNECTION
            (argument: not used)
          
            For an application linked against the
            libmysqld embedded server library, this
            forces the use of the embedded server for the connection.
            This option is ignored for applications linked against the
            libmysqlclient client library.
          
MYSQL_OPT_USE_REMOTE_CONNECTION
            (argument: not used)
          
            For an application linked against the
            libmysqld embedded server library, this
            forces the use of a remote server for the connection. This
            option is ignored for applications linked against the
            libmysqlclient client library.
          
MYSQL_OPT_USE_RESULT (argument: not used)
          
            This option is unused.
          
MYSQL_OPT_WRITE_TIMEOUT (argument type:
            unsigned int *)
          
            The timeout in seconds for each attempt to write to the
            server. There is a retry if necessary, so the total
            effective timeout value is two times the option value.
          
MYSQL_PLUGIN_DIR (argument type:
            char *)
          
            The directory in which to look for client plugins.
          
MYSQL_READ_DEFAULT_FILE (argument type:
            char *)
          
            Read options from the named option file instead of from
            my.cnf.
          
MYSQL_READ_DEFAULT_GROUP (argument type:
            char *)
          
            Read options from the named group from
            my.cnf or the file specified with
            MYSQL_READ_DEFAULT_FILE.
          
MYSQL_REPORT_DATA_TRUNCATION (argument
            type: my_bool *)
          
            Enable or disable reporting of data truncation errors for
            prepared statements using the error
            member of MYSQL_BIND structures.
            (Default: enabled.)
          
MYSQL_SECURE_AUTH (argument type:
            my_bool *)
          
            Whether to connect to a server that does not support the
            password hashing used in MySQL 4.1.1 and later. This option
            is enabled by default.
          
MYSQL_SERVER_PUBLIC_KEY (argument type:
            char *)
          
            The path name to a file containing the server RSA public
            key. The file must be in PEM format. The public key is used
            for RSA encryption of the client password for connections to
            the server made using accounts that authenticate with the
            sha256_password plugin. This option is
            ignored for client accounts that do not authenticate with
            that plugin. It is also ignored if password encryption is
            not needed, as is the case when the client connects to the
            server using an SSL connection.
          
            The server sends the public key to the client as needed, so
            it is not necessary to use this option for RSA password
            encryption to occur. It is more efficient to do so because
            then the server need not send the key.
          
            For additional discussion regarding use of the
            sha256_password plugin, including how to
            get the RSA public key, see
            Section 7.5.1.4, “The SHA-256 Authentication Plugin”.
          
MYSQL_SET_CHARSET_DIR (argument type:
            char *)
          
            The path name to the directory that contains character set
            definition files.
          
MYSQL_SET_CHARSET_NAME (argument type:
            char *)
          
            The name of the character set to use as the default
            character set. The argument can be
            MYSQL_AUTODETECT_CHARSET_NAME to cause
            the character set to be autodetected based on the operating
            system setting (see Section 11.1.5, “Connection Character Sets and Collations”).
          
MYSQL_SET_CLIENT_IP (argument type:
            char *)
          
            For an application linked against the
            libmysqld embedded server library (when
            libmysqld is compiled with authentication
            support), this means that the user is considered to have
            connected from the specified IP address (specified as a
            string) for authentication purposes. This option is ignored
            for applications linked against the
            libmysqlclient client library.
          
MYSQL_SHARED_MEMORY_BASE_NAME (argument
            type: char *)
          
            The name of the shared-memory object for communication to
            the server on Windows, if the server supports shared-memory
            connections. Specify the same value as the
            --shared-memory-base-name
            option used for the mysqld server you
            want to connect to.MYSQL_DEFAULT_AUTH (argument type:
            char *)
          
            The name of the authentication plugin to use.MYSQL_DEFAULT_AUTH (argument type:
            char *)MYSQL_DEFAULT_AUTHchar *The name of the authentication plugin to use.MYSQL_ENABLE_CLEARTEXT_PLUGIN (argument
            type: my_bool *)
          
            Enable the mysql_clear_password cleartext
            authentication plugin. (See
            Section 7.5.1.8, “The Cleartext Client-Side Authentication Plugin”.)MYSQL_ENABLE_CLEARTEXT_PLUGIN (argument
            type: my_bool *)MYSQL_ENABLE_CLEARTEXT_PLUGINmy_bool *Enable the mysql_clear_password cleartext
            authentication plugin. (See
            Section 7.5.1.8, “The Cleartext Client-Side Authentication Plugin”.)mysql_clear_passwordSection 7.5.1.8, “The Cleartext Client-Side Authentication Plugin”MYSQL_INIT_COMMAND (argument type:
            char *)
          
            SQL statement to execute when connecting to the MySQL
            server. Automatically re-executed if reconnection occurs.MYSQL_INIT_COMMAND (argument type:
            char *)MYSQL_INIT_COMMANDchar *SQL statement to execute when connecting to the MySQL
            server. Automatically re-executed if reconnection occurs.MYSQL_OPT_BIND (argument: char
            *)
          
            The network interface from which to connect to the server.
            This is used when the client host has multiple network
            interfaces. The argument is a host name or IP address
            (specified as a string).MYSQL_OPT_BIND (argument: char
            *)MYSQL_OPT_BINDchar
            *The network interface from which to connect to the server.
            This is used when the client host has multiple network
            interfaces. The argument is a host name or IP address
            (specified as a string).MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
            (argument type: my_bool *)
          
            Indicate whether the client can handle expired passwords.
            For more information, see
            Section 7.3.7, “Password Expiration and Sandbox Mode”.MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
            (argument type: my_bool *)MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDSmy_bool *Indicate whether the client can handle expired passwords.
            For more information, see
            Section 7.3.7, “Password Expiration and Sandbox Mode”.Section 7.3.7, “Password Expiration and Sandbox Mode”MYSQL_OPT_COMPRESS (argument: not used)
          
            Use the compressed client/server protocol.MYSQL_OPT_COMPRESS (argument: not used)MYSQL_OPT_COMPRESSUse the compressed client/server protocol.MYSQL_OPT_CONNECT_ATTR_DELETE (argument
            type: char *)
          
            Given a key name, this option deletes a key/value pair from
            the current set of connection attributes to pass to the
            server at connect time. The argument is a pointer to a
            null-terminated string naming the key. Comparison of the key
            name with existing keys is case sensitive.
          
            See also the description for the
            MYSQL_OPT_CONNECT_ATTR_RESET option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.
          
            The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.MYSQL_OPT_CONNECT_ATTR_DELETE (argument
            type: char *)MYSQL_OPT_CONNECT_ATTR_DELETEchar *Given a key name, this option deletes a key/value pair from
            the current set of connection attributes to pass to the
            server at connect time. The argument is a pointer to a
            null-terminated string naming the key. Comparison of the key
            name with existing keys is case sensitive.See also the description for the
            MYSQL_OPT_CONNECT_ATTR_RESET option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.MYSQL_OPT_CONNECT_ATTR_RESETMYSQL_OPT_CONNECT_ATTR_ADDmysql_options4()mysql_options4()The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.session_connect_attrssession_connect_attrssession_account_connect_attrssession_account_connect_attrsSection 23.9.9, “Performance Schema Connection Attribute Tables”MYSQL_OPT_CONNECT_ATTR_RESET (argument
            not used)
          
            This option resets (clears) the current set of connection
            attributes to pass to the server at connect time.
          
            See also the description for the
            MYSQL_OPT_CONNECT_ATTR_DELETE option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.
          
            The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.MYSQL_OPT_CONNECT_ATTR_RESET (argument
            not used)MYSQL_OPT_CONNECT_ATTR_RESETThis option resets (clears) the current set of connection
            attributes to pass to the server at connect time.See also the description for the
            MYSQL_OPT_CONNECT_ATTR_DELETE option, as
            well as the description for the
            MYSQL_OPT_CONNECT_ATTR_ADD option in the
            description of the
            mysql_options4() function.
            That function description also includes a usage example.MYSQL_OPT_CONNECT_ATTR_DELETEMYSQL_OPT_CONNECT_ATTR_ADDmysql_options4()mysql_options4()The Performance Schema exposes connection attributes through
            the session_connect_attrs and
            session_account_connect_attrs
            tables. See
            Section 23.9.9, “Performance Schema Connection Attribute Tables”.session_connect_attrssession_connect_attrssession_account_connect_attrssession_account_connect_attrsSection 23.9.9, “Performance Schema Connection Attribute Tables”MYSQL_OPT_CONNECT_TIMEOUT (argument type:
            unsigned int *)
          
            The connect timeout in seconds.MYSQL_OPT_CONNECT_TIMEOUT (argument type:
            unsigned int *)MYSQL_OPT_CONNECT_TIMEOUTunsigned int *The connect timeout in seconds.MYSQL_OPT_GUESS_CONNECTION (argument: not
            used)
          
            For an application linked against the
            libmysqld embedded server library, this
            enables the library to guess whether to use the embedded
            server or a remote server. “Guess” means that
            if the host name is set and is not
            localhost, it uses a remote server. This
            behavior is the default.
            MYSQL_OPT_USE_EMBEDDED_CONNECTION and
            MYSQL_OPT_USE_REMOTE_CONNECTION can be
            used to override it. This option is ignored for applications
            linked against the libmysqlclient client
            library.MYSQL_OPT_GUESS_CONNECTION (argument: not
            used)MYSQL_OPT_GUESS_CONNECTIONFor an application linked against the
            libmysqld embedded server library, this
            enables the library to guess whether to use the embedded
            server or a remote server. “Guess” means that
            if the host name is set and is not
            localhost, it uses a remote server. This
            behavior is the default.
            MYSQL_OPT_USE_EMBEDDED_CONNECTION and
            MYSQL_OPT_USE_REMOTE_CONNECTION can be
            used to override it. This option is ignored for applications
            linked against the libmysqlclient client
            library.libmysqld“Guess”GuesslocalhostMYSQL_OPT_USE_EMBEDDED_CONNECTIONMYSQL_OPT_USE_REMOTE_CONNECTIONlibmysqlclientMYSQL_OPT_LOCAL_INFILE (argument type:
            optional pointer to unsigned int)
          
            If no pointer is given or if pointer points to an
            unsigned int that has a nonzero value,
            the LOAD DATA
            LOCAL INFILE statement is enabled.MYSQL_OPT_LOCAL_INFILE (argument type:
            optional pointer to unsigned int)MYSQL_OPT_LOCAL_INFILEunsigned intIf no pointer is given or if pointer points to an
            unsigned int that has a nonzero value,
            the LOAD DATA
            LOCAL INFILE statement is enabled.unsigned intLOAD DATA
            LOCAL INFILELOAD DATA
            LOCAL INFILEMYSQL_OPT_MAX_ALLOWED_PACKET (argument:
            unsigned long *)
          
            This option sets the
            max_allowed_packet system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.MYSQL_OPT_MAX_ALLOWED_PACKET (argument:
            unsigned long *)MYSQL_OPT_MAX_ALLOWED_PACKETunsigned long *This option sets the
            max_allowed_packet system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.max_allowed_packetmax_allowed_packetmysqlNULLmysqlNULLMYSQL_OPT_NAMED_PIPE (argument: not used)
          
            Use a named pipe to connect to the MySQL server on Windows,
            if the server permits named-pipe connections.MYSQL_OPT_NAMED_PIPE (argument: not used)MYSQL_OPT_NAMED_PIPEUse a named pipe to connect to the MySQL server on Windows,
            if the server permits named-pipe connections.MYSQL_OPT_NET_BUFFER_LENGTH (argument:
            unsigned long *)
          
            This option sets the
            net_buffer_length system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.MYSQL_OPT_NET_BUFFER_LENGTH (argument:
            unsigned long *)MYSQL_OPT_NET_BUFFER_LENGTHunsigned long *This option sets the
            net_buffer_length system
            variable. If the mysql argument is
            non-NULL, the call sets the session
            system variable value for that session. If
            mysql is NULL, the
            call sets the global system variable value. This option was
            added in MySQL 5.7.9.net_buffer_lengthnet_buffer_lengthmysqlNULLmysqlNULLMYSQL_OPT_PROTOCOL (argument type:
            unsigned int *)
          
            Type of protocol to use. Specify one of the enum values of
            mysql_protocol_type defined in
            mysql.h.MYSQL_OPT_PROTOCOL (argument type:
            unsigned int *)MYSQL_OPT_PROTOCOLunsigned int *Type of protocol to use. Specify one of the enum values of
            mysql_protocol_type defined in
            mysql.h.mysql_protocol_typemysql.hMYSQL_OPT_READ_TIMEOUT (argument type:
            unsigned int *)
          
            The timeout in seconds for each attempt to read from the
            server. There are retries if necessary, so the total
            effective timeout value is three times the option value. You
            can set the value so that a lost connection can be detected
            earlier than the TCP/IP
            Close_Wait_Timeout value of 10 minutes.MYSQL_OPT_READ_TIMEOUT (argument type:
            unsigned int *)MYSQL_OPT_READ_TIMEOUTunsigned int *The timeout in seconds for each attempt to read from the
            server. There are retries if necessary, so the total
            effective timeout value is three times the option value. You
            can set the value so that a lost connection can be detected
            earlier than the TCP/IP
            Close_Wait_Timeout value of 10 minutes.Close_Wait_TimeoutMYSQL_OPT_RECONNECT (argument type:
            my_bool *)
          
            Enable or disable automatic reconnection to the server if
            the connection is found to have been lost. Reconnect is off
            by default; this option provides a way to set reconnection
            behavior explicitly.MYSQL_OPT_RECONNECT (argument type:
            my_bool *)MYSQL_OPT_RECONNECTmy_bool *Enable or disable automatic reconnection to the server if
            the connection is found to have been lost. Reconnect is off
            by default; this option provides a way to set reconnection
            behavior explicitly.MYSQL_OPT_RETRY_COUNT (argument type:
            unsigned int *)
          
            The retry count for I/O-related system calls that are
            interrupted while connecting to the server or communicating
            with it. The default value is 1 (1 retry if the initial call
            is interrupted for 2 tries total).
          
            This option can be used only by clients that link against a
            C client library compiiled with MySQL Cluster support. It is
            available as of MySQL Cluster 7.5.1.MYSQL_OPT_RETRY_COUNT (argument type:
            unsigned int *)MYSQL_OPT_RETRY_COUNTunsigned int *The retry count for I/O-related system calls that are
            interrupted while connecting to the server or communicating
            with it. The default value is 1 (1 retry if the initial call
            is interrupted for 2 tries total).This option can be used only by clients that link against a
            C client library compiiled with MySQL Cluster support. It is
            available as of MySQL Cluster 7.5.1.MYSQL_OPT_SSL_CA (argument type:
            char *)
          
            The path to a file in PEM format that contains a list of
            trusted SSL CAs.MYSQL_OPT_SSL_CA (argument type:
            char *)MYSQL_OPT_SSL_CAchar *The path to a file in PEM format that contains a list of
            trusted SSL CAs.MYSQL_OPT_SSL_CAPATH (argument type:
            char *)
          
            The path to a directory that contains trusted SSL CA
            certificates in PEM format.MYSQL_OPT_SSL_CAPATH (argument type:
            char *)MYSQL_OPT_SSL_CAPATHchar *The path to a directory that contains trusted SSL CA
            certificates in PEM format.MYSQL_OPT_SSL_CERT (argument type:
            char *)
          
            The name of an SSL certificate file in PEM format to use for
            establishing a secure connection.MYSQL_OPT_SSL_CERT (argument type:
            char *)MYSQL_OPT_SSL_CERTchar *The name of an SSL certificate file in PEM format to use for
            establishing a secure connection.MYSQL_OPT_SSL_CIPHER (argument type:
            char *)
          
            A list of permissible ciphers to use for SSL encryption.MYSQL_OPT_SSL_CIPHER (argument type:
            char *)MYSQL_OPT_SSL_CIPHERchar *A list of permissible ciphers to use for SSL encryption.MYSQL_OPT_SSL_CRL (argument type:
            char *)
          
            The path to a file containing certificate revocation lists
            in PEM format.MYSQL_OPT_SSL_CRL (argument type:
            char *)MYSQL_OPT_SSL_CRLchar *The path to a file containing certificate revocation lists
            in PEM format.MYSQL_OPT_SSL_CRLPATH (argument type:
            char *)
          
            The path to a directory that contains files containing
            certificate revocation lists in PEM format.MYSQL_OPT_SSL_CRLPATH (argument type:
            char *)MYSQL_OPT_SSL_CRLPATHchar *The path to a directory that contains files containing
            certificate revocation lists in PEM format.MYSQL_OPT_SSL_ENFORCE (argument type:
            my_bool *)
          
            Whether to require the connection to use SSL. If enabled and
            an encrypted connection cannot be established, the
            connection attempt fails. This option was added in MySQL
            5.7.3.
          
            This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_REQUIRED.MYSQL_OPT_SSL_ENFORCE (argument type:
            my_bool *)MYSQL_OPT_SSL_ENFORCEmy_bool *Whether to require the connection to use SSL. If enabled and
            an encrypted connection cannot be established, the
            connection attempt fails. This option was added in MySQL
            5.7.3.This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_REQUIRED.MYSQL_OPT_SSL_MODESSL_MODE_REQUIREDMYSQL_OPT_SSL_KEY (argument type:
            char *)
          
            The name of an SSL key file in PEM format to use for
            establishing a secure connection.MYSQL_OPT_SSL_KEY (argument type:
            char *)MYSQL_OPT_SSL_KEYchar *The name of an SSL key file in PEM format to use for
            establishing a secure connection.MYSQL_OPT_SSL_MODE (argument type:
            unsigned int *)
          
            The security state to use for the connection to the server:
            SSL_MODE_DISABLED,
            SSL_MODE_PREFERRED,
            SSL_MODE_REQUIRED,
            SSL_MODE_VERIFY_CA,
            SSL_MODE_VERIFY_IDENTITY. The default is
            SSL_MODE_PREFERRED. These modes are the
            permitted values of the mysql_ssl_mode
            enumeration defined in mysql.h. For
            more information about the security modes, see the
            description of --ssl-mode in
            Section 7.4.5, “Command Options for Secure Connections”.
          
            This option was added in MySQL 5.7.11.MYSQL_OPT_SSL_MODE (argument type:
            unsigned int *)MYSQL_OPT_SSL_MODEunsigned int *The security state to use for the connection to the server:
            SSL_MODE_DISABLED,
            SSL_MODE_PREFERRED,
            SSL_MODE_REQUIRED,
            SSL_MODE_VERIFY_CA,
            SSL_MODE_VERIFY_IDENTITY. The default is
            SSL_MODE_PREFERRED. These modes are the
            permitted values of the mysql_ssl_mode
            enumeration defined in mysql.h. For
            more information about the security modes, see the
            description of --ssl-mode in
            Section 7.4.5, “Command Options for Secure Connections”.SSL_MODE_DISABLEDSSL_MODE_PREFERREDSSL_MODE_REQUIREDSSL_MODE_VERIFY_CASSL_MODE_VERIFY_IDENTITYSSL_MODE_PREFERREDmysql_ssl_modemysql.h--ssl-modeSection 7.4.5, “Command Options for Secure Connections”This option was added in MySQL 5.7.11.MYSQL_OPT_SSL_VERIFY_SERVER_CERT
            (argument type: my_bool *)
          
            Enable or disable verification of the server's Common Name
            value in its certificate against the host name used when
            connecting to the server. The connection is rejected if
            there is a mismatch. For encrypted connections, this feature
            can be used to prevent man-in-the-middle attacks.
            Verification is disabled by default.
          
            This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_VERIFY_IDENTITY.MYSQL_OPT_SSL_VERIFY_SERVER_CERT
            (argument type: my_bool *)MYSQL_OPT_SSL_VERIFY_SERVER_CERTmy_bool *Enable or disable verification of the server's Common Name
            value in its certificate against the host name used when
            connecting to the server. The connection is rejected if
            there is a mismatch. For encrypted connections, this feature
            can be used to prevent man-in-the-middle attacks.
            Verification is disabled by default.This option is deprecated as of MySQL 5.7.11 and is removed
            in MySQL 8.0. It is preferable to use
            MYSQL_OPT_SSL_MODE with a value of
            SSL_MODE_VERIFY_IDENTITY.MYSQL_OPT_SSL_MODESSL_MODE_VERIFY_IDENTITYMYSQL_OPT_TLS_VERSION (argument type:
            char *)
          
            The protocols permitted by the client for encrypted
            connections. The value is a comma-separated list containing
            one or more protocol names. The protocols that can be named
            for this option depend on the SSL library used to compile
            MySQL. For details, see
            Section 7.4.3, “Secure Connection Protocols and Ciphers”.
          
            This option was added in MySQL 5.7.10.MYSQL_OPT_TLS_VERSION (argument type:
            char *)MYSQL_OPT_TLS_VERSIONchar *The protocols permitted by the client for encrypted
            connections. The value is a comma-separated list containing
            one or more protocol names. The protocols that can be named
            for this option depend on the SSL library used to compile
            MySQL. For details, see
            Section 7.4.3, “Secure Connection Protocols and Ciphers”.Section 7.4.3, “Secure Connection Protocols and Ciphers”This option was added in MySQL 5.7.10.MYSQL_OPT_USE_EMBEDDED_CONNECTION
            (argument: not used)
          
            For an application linked against the
            libmysqld embedded server library, this
            forces the use of the embedded server for the connection.
            This option is ignored for applications linked against the
            libmysqlclient client library.MYSQL_OPT_USE_EMBEDDED_CONNECTION
            (argument: not used)MYSQL_OPT_USE_EMBEDDED_CONNECTIONFor an application linked against the
            libmysqld embedded server library, this
            forces the use of the embedded server for the connection.
            This option is ignored for applications linked against the
            libmysqlclient client library.libmysqldlibmysqlclientMYSQL_OPT_USE_REMOTE_CONNECTION
            (argument: not used)
          
            For an application linked against the
            libmysqld embedded server library, this
            forces the use of a remote server for the connection. This
            option is ignored for applications linked against the
            libmysqlclient client library.MYSQL_OPT_USE_REMOTE_CONNECTION
            (argument: not used)MYSQL_OPT_USE_REMOTE_CONNECTIONFor an application linked against the
            libmysqld embedded server library, this
            forces the use of a remote server for the connection. This
            option is ignored for applications linked against the
            libmysqlclient client library.libmysqldlibmysqlclientMYSQL_OPT_USE_RESULT (argument: not used)
          
            This option is unused.MYSQL_OPT_USE_RESULT (argument: not used)MYSQL_OPT_USE_RESULTThis option is unused.MYSQL_OPT_WRITE_TIMEOUT (argument type:
            unsigned int *)
          
            The timeout in seconds for each attempt to write to the
            server. There is a retry if necessary, so the total
            effective timeout value is two times the option value.MYSQL_OPT_WRITE_TIMEOUT (argument type:
            unsigned int *)MYSQL_OPT_WRITE_TIMEOUTunsigned int *The timeout in seconds for each attempt to write to the
            server. There is a retry if necessary, so the total
            effective timeout value is two times the option value.MYSQL_PLUGIN_DIR (argument type:
            char *)
          
            The directory in which to look for client plugins.MYSQL_PLUGIN_DIR (argument type:
            char *)MYSQL_PLUGIN_DIRchar *The directory in which to look for client plugins.MYSQL_READ_DEFAULT_FILE (argument type:
            char *)
          
            Read options from the named option file instead of from
            my.cnf.MYSQL_READ_DEFAULT_FILE (argument type:
            char *)MYSQL_READ_DEFAULT_FILEchar *Read options from the named option file instead of from
            my.cnf.my.cnfMYSQL_READ_DEFAULT_GROUP (argument type:
            char *)
          
            Read options from the named group from
            my.cnf or the file specified with
            MYSQL_READ_DEFAULT_FILE.MYSQL_READ_DEFAULT_GROUP (argument type:
            char *)MYSQL_READ_DEFAULT_GROUPchar *Read options from the named group from
            my.cnf or the file specified with
            MYSQL_READ_DEFAULT_FILE.my.cnfMYSQL_READ_DEFAULT_FILEMYSQL_REPORT_DATA_TRUNCATION (argument
            type: my_bool *)
          
            Enable or disable reporting of data truncation errors for
            prepared statements using the error
            member of MYSQL_BIND structures.
            (Default: enabled.)MYSQL_REPORT_DATA_TRUNCATION (argument
            type: my_bool *)MYSQL_REPORT_DATA_TRUNCATIONmy_bool *Enable or disable reporting of data truncation errors for
            prepared statements using the error
            member of MYSQL_BIND structures.
            (Default: enabled.)errorMYSQL_BINDMYSQL_SECURE_AUTH (argument type:
            my_bool *)
          
            Whether to connect to a server that does not support the
            password hashing used in MySQL 4.1.1 and later. This option
            is enabled by default.MYSQL_SECURE_AUTH (argument type:
            my_bool *)MYSQL_SECURE_AUTHmy_bool *Whether to connect to a server that does not support the
            password hashing used in MySQL 4.1.1 and later. This option
            is enabled by default.MYSQL_SERVER_PUBLIC_KEY (argument type:
            char *)
          
            The path name to a file containing the server RSA public
            key. The file must be in PEM format. The public key is used
            for RSA encryption of the client password for connections to
            the server made using accounts that authenticate with the
            sha256_password plugin. This option is
            ignored for client accounts that do not authenticate with
            that plugin. It is also ignored if password encryption is
            not needed, as is the case when the client connects to the
            server using an SSL connection.
          
            The server sends the public key to the client as needed, so
            it is not necessary to use this option for RSA password
            encryption to occur. It is more efficient to do so because
            then the server need not send the key.
          
            For additional discussion regarding use of the
            sha256_password plugin, including how to
            get the RSA public key, see
            Section 7.5.1.4, “The SHA-256 Authentication Plugin”.MYSQL_SERVER_PUBLIC_KEY (argument type:
            char *)MYSQL_SERVER_PUBLIC_KEYchar *The path name to a file containing the server RSA public
            key. The file must be in PEM format. The public key is used
            for RSA encryption of the client password for connections to
            the server made using accounts that authenticate with the
            sha256_password plugin. This option is
            ignored for client accounts that do not authenticate with
            that plugin. It is also ignored if password encryption is
            not needed, as is the case when the client connects to the
            server using an SSL connection.sha256_passwordThe server sends the public key to the client as needed, so
            it is not necessary to use this option for RSA password
            encryption to occur. It is more efficient to do so because
            then the server need not send the key.For additional discussion regarding use of the
            sha256_password plugin, including how to
            get the RSA public key, see
            Section 7.5.1.4, “The SHA-256 Authentication Plugin”.sha256_passwordSection 7.5.1.4, “The SHA-256 Authentication Plugin”MYSQL_SET_CHARSET_DIR (argument type:
            char *)
          
            The path name to the directory that contains character set
            definition files.MYSQL_SET_CHARSET_DIR (argument type:
            char *)MYSQL_SET_CHARSET_DIRchar *The path name to the directory that contains character set
            definition files.MYSQL_SET_CHARSET_NAME (argument type:
            char *)
          
            The name of the character set to use as the default
            character set. The argument can be
            MYSQL_AUTODETECT_CHARSET_NAME to cause
            the character set to be autodetected based on the operating
            system setting (see Section 11.1.5, “Connection Character Sets and Collations”).MYSQL_SET_CHARSET_NAME (argument type:
            char *)MYSQL_SET_CHARSET_NAMEchar *The name of the character set to use as the default
            character set. The argument can be
            MYSQL_AUTODETECT_CHARSET_NAME to cause
            the character set to be autodetected based on the operating
            system setting (see Section 11.1.5, “Connection Character Sets and Collations”).MYSQL_AUTODETECT_CHARSET_NAMESection 11.1.5, “Connection Character Sets and Collations”MYSQL_SET_CLIENT_IP (argument type:
            char *)
          
            For an application linked against the
            libmysqld embedded server library (when
            libmysqld is compiled with authentication
            support), this means that the user is considered to have
            connected from the specified IP address (specified as a
            string) for authentication purposes. This option is ignored
            for applications linked against the
            libmysqlclient client library.MYSQL_SET_CLIENT_IP (argument type:
            char *)MYSQL_SET_CLIENT_IPchar *For an application linked against the
            libmysqld embedded server library (when
            libmysqld is compiled with authentication
            support), this means that the user is considered to have
            connected from the specified IP address (specified as a
            string) for authentication purposes. This option is ignored
            for applications linked against the
            libmysqlclient client library.libmysqldlibmysqldlibmysqlclientMYSQL_SHARED_MEMORY_BASE_NAME (argument
            type: char *)
          
            The name of the shared-memory object for communication to
            the server on Windows, if the server supports shared-memory
            connections. Specify the same value as the
            --shared-memory-base-name
            option used for the mysqld server you
            want to connect to.MYSQL_SHARED_MEMORY_BASE_NAME (argument
            type: char *)MYSQL_SHARED_MEMORY_BASE_NAMEchar *The name of the shared-memory object for communication to
            the server on Windows, if the server supports shared-memory
            connections. Specify the same value as the
            --shared-memory-base-name
            option used for the mysqld server you
            want to connect to.--shared-memory-base-name--shared-memory-base-namemysqldmysqldmysqldThe client group is always read if you use
        MYSQL_READ_DEFAULT_FILE or
        MYSQL_READ_DEFAULT_GROUP.clientMYSQL_READ_DEFAULT_FILEMYSQL_READ_DEFAULT_GROUPThe specified group in the option file may contain the following
        options.OptionDescriptioncharacter-sets-dir=dir_nameThe directory where character sets are installed.compressUse the compressed client/server protocol.connect-timeout=secondsThe connect timeout in seconds. On Linux this timeout is also used for
                waiting for the first answer from the server.database=db_nameConnect to this database if no database was specified in the connect
                command.debugDebug options.default-character-set=charset_nameThe default character set to use.disable-local-infileDisable use of LOAD DATA
                LOCAL INFILE.enable-cleartext-pluginEnable the mysql_clear_password cleartext
                authentication plugin.host=host_nameDefault host name.init-command=stmtStatement to execute when connecting to MySQL server. Automatically
                re-executed if reconnection occurs.interactive-timeout=secondsSame as specifying CLIENT_


Syntax

int mysql_options(MYSQL *mysql, enum mysql_option
        option, const void *arg)


Example

MYSQL mysql;

mysql_init(&mysql);
mysql_options(&mysql,MYSQL_OPT_COMPRESS,0);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"odbc");
mysql_options(&mysql,MYSQL_INIT_COMMAND,"SET autocommit=0");
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
{
    fprintf(stderr, "Failed to connect to database: Error: %s\n",
          mysql_error(&mysql));
}


Output / Return Value

 Zero for success. Nonzero if you specify an unknown option.


Limitations


Alternatives / See Also


Reference