Skip to content

Commit 8e9a80b

Browse files
committed
clean up floating pages
1 parent 65061a8 commit 8e9a80b

File tree

7 files changed

+171
-215
lines changed

7 files changed

+171
-215
lines changed

docs/integrations/data-ingestion/dbms/mysql/index.md

Lines changed: 0 additions & 152 deletions
This file was deleted.

docs/integrations/data-ingestion/redshift/index.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/integrations/data-sources/mysql.md

Lines changed: 142 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,146 @@ hide_title: true
66
description: 'Page describing MySQL integration'
77
---
88

9-
import MySQL from '@site/docs/integrations/data-ingestion/dbms/mysql/index.md';
9+
import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';
10+
import ExperimentalBadge from '@theme/badges/ExperimentalBadge';
11+
12+
# Integrating MySQL with ClickHouse
13+
14+
This page covers using the `MySQL` table engine, for reading from a MySQL table.
15+
16+
:::note
17+
For ClickHouse Cloud, you can also use the [MySQL ClickPipe](/integrations/clickpipes/mysql) (currently in public beta) to easily move data from your MySQL tables to ClickHouse.
18+
:::
19+
20+
## Connecting ClickHouse to MySQL using the MySQL Table Engine {#connecting-clickhouse-to-mysql-using-the-mysql-table-engine}
21+
22+
The `MySQL` table engine allows you to connect ClickHouse to MySQL. **SELECT** and **INSERT** statements can be made in either ClickHouse or in the MySQL table. This article illustrates the basic methods of how to use the `MySQL` table engine.
23+
24+
### 1. Configure MySQL {#1-configure-mysql}
25+
26+
1. Create a database in MySQL:
27+
```sql
28+
CREATE DATABASE db1;
29+
```
30+
31+
2. Create a table:
32+
```sql
33+
CREATE TABLE db1.table1 (
34+
id INT,
35+
column1 VARCHAR(255)
36+
);
37+
```
38+
39+
3. Insert sample rows:
40+
```sql
41+
INSERT INTO db1.table1
42+
(id, column1)
43+
VALUES
44+
(1, 'abc'),
45+
(2, 'def'),
46+
(3, 'ghi');
47+
```
48+
49+
4. Create a user to connect from ClickHouse:
50+
```sql
51+
CREATE USER 'mysql_clickhouse'@'%' IDENTIFIED BY 'Password123!';
52+
```
53+
54+
5. Grant privileges as needed. (For demonstration purposes, the `mysql_clickhouse` user is granted admin privileges.)
55+
```sql
56+
GRANT ALL PRIVILEGES ON *.* TO 'mysql_clickhouse'@'%';
57+
```
58+
59+
:::note
60+
If you are using this feature in ClickHouse Cloud, you may need the to allow the ClickHouse Cloud IP addresses to access your MySQL instance.
61+
Check the ClickHouse [Cloud Endpoints API](//cloud/get-started/query-endpoints.md) for egress traffic details.
62+
:::
63+
64+
### 2. Define a Table in ClickHouse {#2-define-a-table-in-clickhouse}
65+
66+
1. Now let's create a ClickHouse table that uses the `MySQL` table engine:
67+
```sql
68+
CREATE TABLE mysql_table1 (
69+
id UInt64,
70+
column1 String
71+
)
72+
ENGINE = MySQL('mysql-host.domain.com','db1','table1','mysql_clickhouse','Password123!')
73+
```
74+
75+
The minimum parameters are:
76+
77+
|parameter|Description |example |
78+
|---------|----------------------------|---------------------|
79+
|host |hostname or IP |mysql-host.domain.com|
80+
|database |mysql database name |db1 |
81+
|table |mysql table name |table1 |
82+
|user |username to connect to mysql|mysql_clickhouse |
83+
|password |password to connect to mysql|Password123! |
84+
85+
:::note
86+
View the [MySQL table engine](/engines/table-engines/integrations/mysql.md) doc page for a complete list of parameters.
87+
:::
88+
89+
### 3. Test the Integration {#3-test-the-integration}
90+
91+
1. In MySQL, insert a sample row:
92+
```sql
93+
INSERT INTO db1.table1
94+
(id, column1)
95+
VALUES
96+
(4, 'jkl');
97+
```
98+
99+
2. Notice the existing rows from the MySQL table are in the ClickHouse table, along with the new row you just added:
100+
```sql
101+
SELECT
102+
id,
103+
column1
104+
FROM mysql_table1
105+
```
106+
107+
You should see 4 rows:
108+
```response
109+
Query id: 6d590083-841e-4e95-8715-ef37d3e95197
110+
111+
┌─id─┬─column1─┐
112+
│ 1 │ abc │
113+
│ 2 │ def │
114+
│ 3 │ ghi │
115+
│ 4 │ jkl │
116+
└────┴─────────┘
117+
118+
4 rows in set. Elapsed: 0.044 sec.
119+
```
120+
121+
3. Let's add a row to the ClickHouse table:
122+
```sql
123+
INSERT INTO mysql_table1
124+
(id, column1)
125+
VALUES
126+
(5,'mno')
127+
```
128+
129+
4. Notice the new row appears in MySQL:
130+
```bash
131+
mysql> select id,column1 from db1.table1;
132+
```
133+
134+
You should see the new row:
135+
```response
136+
+------+---------+
137+
| id | column1 |
138+
+------+---------+
139+
| 1 | abc |
140+
| 2 | def |
141+
| 3 | ghi |
142+
| 4 | jkl |
143+
| 5 | mno |
144+
+------+---------+
145+
5 rows in set (0.01 sec)
146+
```
147+
148+
### Summary {#summary}
149+
150+
The `MySQL` table engine allows you to connect ClickHouse to MySQL to exchange data back and forth. For more details, be sure to check out the documentation page for the [MySQL table engine](/sql-reference/table-functions/mysql.md).
10151
11-
<MySQL/>

docs/integrations/migration/_category_.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/integrations/migration/index.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

sidebars.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ const sidebars = {
635635
],
636636
},
637637
],
638-
}
638+
},
639+
"integrations/data-ingestion/dbms/dynamodb"
639640
],
640641
},
641642
{
@@ -1605,10 +1606,18 @@ const sidebars = {
16051606
href: "/use-cases"
16061607
},
16071608
{
1608-
type: "link",
1609+
type: "category",
16091610
label: "Tips and Community Wisdom",
1610-
description: "Community Lessons",
1611-
href: "/tips-and-tricks/community-wisdom"
1611+
className: "top-nav-item",
1612+
collapsed: true,
1613+
collapsible: true,
1614+
link: { type: "doc", id: "tips-and-tricks/community-wisdom" },
1615+
items: [
1616+
{
1617+
type: "autogenerated",
1618+
dirName: "tips-and-tricks",
1619+
}
1620+
]
16121621
},
16131622
{
16141623
type: "link",

0 commit comments

Comments
 (0)