Skip to content

Commit

Permalink
Merge pull request #2416 from ClickHouse/update-multiple-mysql-users-…
Browse files Browse the repository at this point in the history
…docs

Update the MySQL docs regarding multiple users
  • Loading branch information
mshustov authored Jun 19, 2024
2 parents c7a64cc + c973714 commit ea64c37
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions docs/en/_snippets/_clickhouse_mysql_cloud_setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Alternatively, in order to enable the MySQL interface for an existing service:

## Creating multiple MySQL users in ClickHouse Cloud

By default, there is a built-in `mysql4<subdomain>` user. The `<subdomain>` part is the first segment of your ClickHouse Cloud hostname. This format is necessary to work with the tools that implement secure connection, but don't provide [SNI information in their TLS handshake](https://www.cloudflare.com/learning/ssl/what-is-sni), which makes it impossible to do the internal routing without an extra hint in the username. When not sure whether a tool supports TLS SNI, it is better to follow `mysql4<subdomain>_<username>` format, where `<subdomain>` is a hint to identify your Cloud service, and `<username>` is an arbitrary suffix of your choice; if a tool supports TLS SNI, then an arbitrary name can be used for custom MySQL users.
By default, there is a built-in `mysql4<subdomain>` user, which uses the same password as the `default` one. The `<subdomain>` part is the first segment of your ClickHouse Cloud hostname. This format is necessary to work with the tools that implement secure connection, but don't provide [SNI information in their TLS handshake](https://www.cloudflare.com/learning/ssl/what-is-sni), which makes it impossible to do the internal routing without an extra hint in the username (MySQL console client is one of such tools).

Because of this, we _highly recommend_ following the `mysql4<subdomain>_<username>` format when creating a new user intended to be used with the MySQL interface, where `<subdomain>` is a hint to identify your Cloud service, and `<username>` is an arbitrary suffix of your choice.

:::tip
For ClickHouse Cloud hostname like `foobar.us-east1.aws.clickhouse.cloud`, the `<subdomain>` part equals to `foobar`, and a custom MySQL username could look like `mysql4foobar_team1`.
Expand Down Expand Up @@ -46,4 +48,14 @@ You can create extra users to use with the MySQL interface if, for example, you
GRANT SELECT ON system.query_log TO mysql4foobar_team1;
```

4. Use the created user to connect to your ClickHouse Cloud service with the MySQL interface.
4. Use the created user to connect to your ClickHouse Cloud service with the MySQL interface.

### Troubleshooting multiple MySQL users in ClickHouse Cloud

If you created a new MySQL user, and you see the following error while connecting via MySQL CLI client:

```
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 54
```

In this case, ensure that the username follows the `mysql4<subdomain>_<username>` format, as described ([above](#creating-multiple-mysql-users-in-clickhouse-cloud)).

0 comments on commit ea64c37

Please sign in to comment.