Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 33.0Mb
PDF (A4) - 32.9Mb
PDF (RPM) - 30.9Mb
HTML Download (TGZ) - 7.9Mb
HTML Download (Zip) - 7.9Mb
HTML Download (RPM) - 6.7Mb
Man Pages (TGZ) - 143.7Kb
Man Pages (Zip) - 203.9Kb
Info (Gzip) - 3.0Mb
Info (Zip) - 3.0Mb


MySQL 8.0 Reference Manual  /  ...  /  Command Options for Secure Connections

Pre-General Availability Draft: 2017-08-19

6.4.2 Command Options for Secure Connections

This section describes options that specify whether to use secure connections and the names of certificate and key files. These options can be given on the command line or in an option file. For examples of suggested use and how to check whether a connection is secure, see Section 6.4.1, “Configuring MySQL to Use Secure Connections”.

Table 6.9 Secure-Connection Option Summary

FormatDescription
--skip-sslDo not use secure connection
--sslEnable secure connection
--ssl-caPath of file that contains list of trusted SSL CAs
--ssl-capathPath of directory that contains trusted SSL CA certificates in PEM format
--ssl-certPath of file that contains X509 certificate in PEM format
--ssl-cipherList of permitted ciphers to use for connection encryption
--ssl-crlPath of file that contains certificate revocation lists
--ssl-crlpathPath of directory that contains certificate revocation list files
--ssl-keyPath of file that contains X509 key in PEM format
--ssl-modeSecurity state of connection to server
--tls-versionProtocols permitted for secure connections

  • --ssl

    Note

    The client-side --ssl option is removed in MySQL 8.0. For client programs, use --ssl-mode instead.

    On the server side, the --ssl option specifies that the server permits but does not require secure connections. The option is enabled on the server side by default. --ssl is implied by other --ssl-xxx options, as indicated in the descriptions for those options.

    MySQL servers compiled using OpenSSL can generate missing certificate and key files automatically at startup. See Section 6.4.3.1, “Creating SSL and RSA Certificates and Keys using MySQL”.

    The server performs certificate and key file autodiscovery. If --ssl is enabled (possibly along with --ssl-cipher) and other --ssl-xxx options are not given to configure secure connections explicitly, the server attempts to enable support for secure connections automatically at startup:

    • If the server discovers valid certificate and key files named ca.pem, server-cert.pem, and server-key.pem in the data directory, it enables support for secure connections by clients. (The files need not have been generated automatically; what matters is that they have the indicated names and are valid.)

    • If the server does not find valid certificate and key files in the data directory, it continues executing but does not support secure connections.

    To specify additional parameters for secure connections, use at least --ssl-cert and --ssl-key on the server side and --ssl-ca on the client side. See Section 6.4.1, “Configuring MySQL to Use Secure Connections”.

    The --ssl option in negated form overrides other --ssl-xxx options and indicates that encryption should not be used. To do this, specify the option as --ssl=0 or a synonym (--skip-ssl, --disable-ssl).

  • --ssl-ca=file_name

    The path to a file in PEM format that contains a list of trusted SSL certificate authorities. On the server side, this option implies --ssl.

    If you use encryption when establishing a client connection, to tell the client not to authenticate the server certificate, specify neither --ssl-ca nor --ssl-capath. The server still verifies the client according to any applicable requirements established for the client account, and it still uses any --ssl-ca or --ssl-capath option values specified at server startup.

  • --ssl-capath=dir_name

    The path to a directory that contains trusted SSL certificate authority certificates in PEM format. On the server side, this option implies --ssl.

    If you use encryption when establishing a client connection, to tell the client not to authenticate the server certificate, specify neither --ssl-ca nor --ssl-capath. The server still verifies the client according to any applicable requirements established for the client account, and it still uses any --ssl-ca or --ssl-capath option values specified at server startup.

    MySQL distributions compiled using OpenSSL support the --ssl-capath option (see Section 6.4.4, “OpenSSL Versus yaSSL”). Distributions compiled using yaSSL do not because yaSSL does not look in any directory and does not follow a chained certificate tree. yaSSL requires that all components of the CA certificate tree be contained within a single CA certificate tree and that each certificate in the file has a unique SubjectName value. To work around this yaSSL limitation, concatenate the individual certificate files comprising the certificate tree into a new file and specify that file as the value of the --ssl-ca option.

  • --ssl-cert=file_name

    The name of the SSL certificate file in PEM format to use for establishing a secure connection. On the server side, this option implies --ssl.

  • --ssl-cipher=cipher_list

    A list of permissible ciphers to use for connection encryption. If no cipher in the list is supported, encrypted connections will not work. On the server side, this option implies --ssl.

    For greatest portability, cipher_list should be a list of one or more cipher names, separated by colons. This format is understood both by OpenSSL and yaSSL. Examples:

    --ssl-cipher=AES128-SHA
    --ssl-cipher=DHE-RSA-AES256-SHA:AES128-SHA

    OpenSSL supports a more flexible syntax for specifying ciphers, as described in the OpenSSL documentation at https://www.openssl.org/docs/manmaster/man1/ciphers.html. yaSSL does not, so attempts to use that extended syntax fail for a MySQL distribution compiled using yaSSL.

    For information about which encryption ciphers MySQL supports, see Section 6.4.6, “Secure Connection Protocols and Ciphers”.

  • --ssl-crl=file_name

    The path to a file containing certificate revocation lists in PEM format. On the server side, this option implies --ssl.

    If neither --ssl-crl nor --ssl-crlpath is given, no CRL checks are performed, even if the CA path contains certificate revocation lists.

    MySQL distributions compiled using OpenSSL support the --ssl-crl option (see Section 6.4.4, “OpenSSL Versus yaSSL”). Distributions compiled using yaSSL do not because revocation lists do not work with yaSSL.

  • --ssl-crlpath=dir_name

    The path to a directory that contains files containing certificate revocation lists in PEM format. On the server side, this option implies --ssl.

    If neither --ssl-crl nor --ssl-crlpath is given, no CRL checks are performed, even if the CA path contains certificate revocation lists.

    MySQL distributions compiled using OpenSSL support the --ssl-crlpath option (see Section 6.4.4, “OpenSSL Versus yaSSL”). Distributions compiled using yaSSL do not because revocation lists do not work with yaSSL.

  • --ssl-key=file_name

    The name of the SSL key file in PEM format to use for establishing a secure connection. On the server side, this option implies --ssl.

    If the key file is protected by a passphrase, the program prompts the user for the passphrase. The password must be given interactively; it cannot be stored in a file. If the passphrase is incorrect, the program continues as if it could not read the key.

    For better security, use a certificate with an RSA key size of at least 2048 bits.

  • --ssl-mode=mode

    This option is available only for client programs, not the server. It specifies the security state of the connection to the server. The following option values are permitted:

    • PREFERRED: Establish a secure (encrypted) connection if the server supports secure connections. Fall back to an unencrypted connection otherwise. This is the default if --ssl-mode is not specified.

    • DISABLED: Establish an unencrypted connection.

    • REQUIRED: Establish a secure connection if the server supports secure connections. The connection attempt fails if a secure connection cannot be established.

    • VERIFY_CA: Like REQUIRED, but additionally verify the server TLS certificate against the configured Certificate Authority (CA) certificates. The connection attempt fails if no valid matching CA certificates are found.

    • VERIFY_IDENTITY: Like VERIFY_CA, but additionally verify that the server certificate matches the host to which the connection is attempted.

    Use of the --ssl-ca or --ssl-capath option implies --ssl-mode=VERIFY_CA, if --ssl-mode is not explicitly set otherwise.

    If --ssl-mode is explicit, use of a value other than VERIFY_CA or VERIFY_IDENTITY with an explicit --ssl-ca or --ssl-capath option produces a warning that no verification of the server certificate will be done, despite CA certificate options being specified.

    To require use of secure connections by a MySQL account, use CREATE USER to create the account with a REQUIRE SSL clause, or use ALTER USER for an existing account to add a REQUIRE SSL clause. Connection attempts by clients that use the account will be rejected unless MySQL supports secure connections and a secure connection can be established.

    The REQUIRE clause permits other encryption-related options, which can be used to enforce requirements stricter than REQUIRE SSL. For additional details about which command options may or must be specified by clients that connect using accounts configured using the various REQUIRE options, see the description of REQUIRE in Section 13.7.1.3, “CREATE USER Syntax”.

  • --tls-version=protocol_list

    For client programs, the protocols permitted by the client for encrypted connections. The value is a comma-separated list containing one or more protocol names. For example:

    mysql --tls-version="TLSv1.1,TLSv1.2"

    The protocols that can be named for this option depend on the SSL library used to compile MySQL. For details, see Section 6.4.6, “Secure Connection Protocols and Ciphers”.

    On the server side, use the tls_version system variable instead.


User Comments
Sign Up Login You must be logged in to post a comment.