Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions enable-tls-between-clients-and-servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ To use connections secured with TLS, you first need to configure the TiDB server
Similar to MySQL, TiDB allows TLS and non-TLS connections on the same TCP port. For a TiDB server with TLS enabled, you can choose to securely connect to the TiDB server through an encrypted connection, or to use an unencrypted connection. You can use the following ways to require the use of secure connections:

+ Configure the system variable [`require_secure_transport`](/system-variables.md#require_secure_transport-new-in-v610) to require secure connections to the TiDB server for all users.
+ Specify `REQUIRE SSL` when you create a user (`create user`), or modify an existing user (`alter user`), which is to specify that specified users must use TLS connections to access TiDB. The following is an example of creating a user:

{{< copyable "sql" >}}
+ Specify `REQUIRE SSL` when you create a user (`CREATE USER`), or modify an existing user (`ALTER USER`), which is to specify that specified users must use TLS connections to access TiDB. The following is an example of creating a user:

```sql
CREATE USER 'u1'@'%' IDENTIFIED BY 'my_random_password' REQUIRE SSL;
Expand Down Expand Up @@ -51,6 +49,10 @@ All the files specified by the parameters are in PEM (Privacy Enhanced Mail) for

If the certificate parameters are correct, TiDB outputs `mysql protocol server secure connection is enabled` to the logs on `"INFO"` level when started.

## Configure TiProxy to use TLS connections

By specifying the [`sql-tls`](/tiproxy/tiproxy-configuration.md#sql-tls) settings in the [TiProxy](/tiproxy/tiproxy-overview.md) configuration, you can enable TiProxy to accept TLS connections. For more details on this and how to enable TLS on backend connections, see [TiProxy Security](/tiproxy/tiproxy-overview.md#security).

## Configure the MySQL client to use TLS connections

The client of MySQL 5.7 or later versions attempts to establish a TLS connection by default. If the server does not support TLS connections, it automatically returns to unencrypted connections. The client of MySQL earlier than version 5.7 uses the non-TLS connections by default.
Expand Down Expand Up @@ -90,7 +92,7 @@ If the `ssl-ca` parameter is not specified in the TiDB server or MySQL client, t
By default, the server-to-client authentication is optional. Even if the client does not present its certificate of identification during the TLS handshake, the TLS connection can be still established. You can also require the client to be authenticated by specifying `REQUIRE x509` when creating a user (`CREATE USER`), or modifying an existing user (`ALTER USER`). The following is an example of creating a user:

```sql
CREATE USER 'u1'@'%' REQUIRE X509;
CREATE USER 'u1'@'%' REQUIRE X509;
```

> **Note:**
Expand Down