my_bool mysql_ssl_set(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char
mysql_ssl_set() does nothing
unless SSL support is enabled in the client library.
mysql: The connection handler returned from
key: The path name to the key file
cert: The path name to the certificate file
ca: The path name to the certificate authority file
capath: The path name to a directory that contains trusted SSL CA certificates in PEM format
cipher: A list of permissible ciphers to use for SSL encryption
mysql argument must be a valid
connection handler. Any unused SSL arguments may be given as
This function always returns
0. If SSL
setup is incorrect, a subsequent
returns an error when you attempt to connect.
mysql_ssl_set() specifies SSL
information such as certificate and key files for establishing
a secure connection if such connections are available, but
does not enforce any requirement that the connection obtained
be secure. To require an encrypted connection, the standard
MySQL client programs use the following technique, which can
also be used by third-party applications:
--ssl-mode=REQUIREDcommand-line option was specified, turn on SSL by calling
mysql_ssl_set()to supply the appropriate SSL values. In addition, call
mysql_options(), passing the
MYSQL_OPT_SSL_MODEoption with a value of
SSL_MODE_REQUIRED. If the
mysql_options()call fails, exit with an error.
mysql_real_connect()to connect to the server. The call fails if an encrypted connection cannot be obtained.