Skip to content

Commit a5bc0e8

Browse files
authored
Merge branch 'main' into revamp_docs_homepage
2 parents 23b3501 + 57252c8 commit a5bc0e8

File tree

120 files changed

+4687
-935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+4687
-935
lines changed

.github/workflows/trademark-cla-approval.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Generate Token
1616
id: generate-token
1717
continue-on-error: true
18-
uses: actions/create-github-app-token@v1
18+
uses: actions/create-github-app-token@v2
1919
with:
2020
app-id: "${{ secrets.WORKFLOW_AUTH_PUBLIC_APP_ID }}"
2121
private-key: "${{ secrets.WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY }}"

.github/workflows/trademark-cla-notice.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Generate Token
2020
id: generate-token
2121
continue-on-error: true
22-
uses: actions/create-github-app-token@v1
22+
uses: actions/create-github-app-token@v2
2323
with:
2424
app-id: "${{ secrets.WORKFLOW_AUTH_PUBLIC_APP_ID }}"
2525
private-key: "${{ secrets.WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY }}"

docs/_snippets/_clickhouse_mysql_cloud_setup.mdx

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,107 @@ import mysql_3 from '@site/static/images/_snippets/mysql3.png';
44
import mysql_4 from '@site/static/images/_snippets/mysql4.png';
55
import mysql_5 from '@site/static/images/_snippets/mysql5.png';
66
import Image from '@theme/IdealImage';
7+
import {VerticalStepper} from "@clickhouse/click-ui/bundled";
78

8-
<br/>
9-
1. After creating your ClickHouse Cloud Service, on the `Connect your app` screen, select MySQL from the drop down.
10-
<br/>
9+
<VerticalStepper headerLevel="h4">
1110

12-
<Image size="md" img={mysql_1} alt="ClickHouse Cloud credentials screen showing MySQL interface selection dropdown" border />
11+
#### Select `Connect your app` {#select-connect-your-app}
1312

14-
2. Toggle the switch to enable the MySQL interface for this specific service. This will expose port `3306` for this service and prompt you with your MySQL connection screen that include your unique MySQL username.
13+
After creating your ClickHouse Cloud Service, on the `Connect your app` screen, select MySQL from the drop down.
1514

16-
<Image size="md" img={mysql_2} alt="ClickHouse Cloud MySQL interface enabling toggle and connection details" border />
17-
<br/>
15+
<Image size="lg" img={mysql_1} alt="ClickHouse Cloud credentials screen showing MySQL interface selection dropdown" border />
16+
17+
#### Enable the MySQL interface {#enable-mysql-interface}
18+
19+
Toggle the switch to enable the MySQL interface for this specific service.
20+
This will expose port `3306` for this service and prompt you with a MySQL connection screen that includes your unique MySQL username.
21+
22+
<Image size="lg" img={mysql_2} alt="ClickHouse Cloud MySQL interface enabling toggle and connection details" border />
1823

1924
Alternatively, in order to enable the MySQL interface for an existing service:
2025

21-
3. Ensure your service is in `Running` state then click on the service you want to enable the MySQL interface for. Select "Connect" from the left menu:
26+
#### Select `Connect` {#select-connect}
27+
28+
Ensure your service is in `Running` state then click on the service you want to enable the MySQL interface for.
29+
Select "Connect" from the left menu:
30+
31+
<Image size="lg" img={mysql_3} alt="ClickHouse Cloud service connection screen with Connect option highlighted" border />
2232

23-
<br/>
24-
<Image size="md" img={mysql_3} alt="ClickHouse Cloud service connection screen with Connect option highlighted" border />
25-
<br/>
33+
#### Choose `MySQL` {#choose-mysql}
2634

27-
4. Select MySQL from the `Connect With` drop down.
35+
Select `MySQL` from the `Connect With` drop down.
2836

29-
<br/>
3037
<Image size="md" img={mysql_4} alt="ClickHouse Cloud connection screen showing MySQL option selection" border />
31-
<br/>
3238

33-
5. Toggle the switch to enable the MySQL interface for this specific service. This will expose port `3306` for this service and prompt you with your MySQL connection screen that include your unique MySQL username.
39+
#### Enable the MySQL interface {#enable-mysql-interface}
40+
41+
Toggle the switch to enable the MySQL interface for this specific service.
42+
This will expose port `3306` for this service and prompt you with your MySQL connection screen that include your unique MySQL username.
43+
44+
</VerticalStepper>
3445

3546
<Image size="md" img={mysql_5} alt="ClickHouse Cloud connection screen with MySQL interface enabled showing connection details" border />
3647

37-
## Creating multiple MySQL users in ClickHouse Cloud {#creating-multiple-mysql-users-in-clickhouse-cloud}
48+
## Creating a readonly MySQL user in ClickHouse Cloud {#creating-multiple-mysql-users-in-clickhouse-cloud}
3849

39-
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).
50+
ClickHouse Cloud automatically creates a `mysql4<subdomain>` user that shares the same password as the default user.
51+
The `<subdomain>` portion corresponds to the first part of your ClickHouse Cloud hostname.
4052

41-
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.
53+
This username format is required for compatibility with tools that establish secure connections but don't include [SNI (Server Name Indication)](https://www.cloudflare.com/learning/ssl/what-is-sni) data in their TLS handshake.
54+
Without SNI information, the system cannot perform proper internal routing, so the subdomain hint embedded in the username provides the necessary routing information.
55+
The MySQL console client is an example of a tool that requires this.
4256

4357
:::tip
44-
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`.
58+
A recommended best practice is to create a new readonly MySQL user.
4559
:::
4660

47-
You can create extra users to use with the MySQL interface if, for example, you need to apply extra settings.
61+
:::note
62+
For a 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`.
63+
:::
4864

49-
1. Optional - create a [settings profile](/sql-reference/statements/create/settings-profile) to apply for your custom user. For example, `my_custom_profile` with an extra setting which will be applied by default when we connect with the user we create later:
65+
<VerticalStepper headerLevel="h4">
5066

51-
```sql
52-
CREATE SETTINGS PROFILE my_custom_profile SETTINGS prefer_column_name_to_alias=1;
53-
```
67+
#### Create a readonly settings profile {#create-a-custom-settings-user}
5468

55-
`prefer_column_name_to_alias` is used just as an example, you can use other settings there.
56-
2. [Create a user](/sql-reference/statements/create/user) using the following format: `mysql4<subdomain>_<username>` ([see above](#creating-multiple-mysql-users-in-clickhouse-cloud)). The password must be in double SHA1 format. For example:
69+
Create a [settings profile](/sql-reference/statements/create/settings-profile) to apply to your readonly user,
70+
setting the `readonly` setting to `1`:
5771

58-
```sql
59-
CREATE USER mysql4foobar_team1 IDENTIFIED WITH double_sha1_password BY 'YourPassword42$';
60-
```
72+
```sql
73+
CREATE SETTINGS PROFILE readonly_profile SETTINGS readonly = 1
74+
```
6175

62-
or if you want to use a custom profile for this user:
76+
#### Create a new readonly MySQL user {#create-a-readonly-mysql-user}
6377

64-
```sql
65-
CREATE USER mysql4foobar_team1 IDENTIFIED WITH double_sha1_password BY 'YourPassword42$' SETTINGS PROFILE 'my_custom_profile';
66-
```
78+
[Create a user](/sql-reference/statements/create/user) with a name following this format:
6779

68-
where `my_custom_profile` is the name of the profile you created earlier.
69-
3. [Grant](/sql-reference/statements/grant) the new user the necessary permissions to interact with the desired tables or databases. For example, if you want to grant access to `system.query_log` only:
80+
```sql
81+
mysql4<subdomain>_<username>
82+
```
83+
84+
Apply the `readonly_profile` to the new user and make sure that the password is in double SHA1 format. For example:
85+
86+
```sql
87+
CREATE USER mysql4foobar_readonly
88+
IDENTIFIED WITH double_sha1_password BY 'YourPassword42$'
89+
SETTINGS PROFILE 'readonly_profile';
90+
```
91+
92+
#### Grant the new user permissions to access the desired tables {#grant-the-new-user-the-necessary-permissions}
93+
94+
[Grant](/sql-reference/statements/grant) the new user the necessary permissions to interact with the desired tables or databases.
95+
For example, if you want to grant access to `system.query_log` only:
96+
97+
```sql
98+
GRANT SELECT ON system.query_log TO mysql4foobar_readonly;
99+
```
100+
101+
:::note
102+
For the readonly user, make sure to only grant `SELECT` permissions to the tables you want to access.
103+
:::
70104

71-
```sql
72-
GRANT SELECT ON system.query_log TO mysql4foobar_team1;
73-
```
105+
The newly created user can be used to connect to your ClickHouse Cloud service with the MySQL interface.
74106

75-
4. Use the created user to connect to your ClickHouse Cloud service with the MySQL interface.
107+
</VerticalStepper>
76108

77109
### Troubleshooting multiple MySQL users in ClickHouse Cloud {#troubleshooting-multiple-mysql-users-in-clickhouse-cloud}
78110

0 commit comments

Comments
 (0)