日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql clickhouse_通过mysql操作clickhouse

發布時間:2025/3/15 数据库 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql clickhouse_通过mysql操作clickhouse 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

mysql軟件安裝

至少需要安裝一個mysql客戶端,即要有mysql這個命令;也可以直接安裝一個mysql數據庫,不用可以不啟動;

clickhouse服務端配置mysql端口

vim /etc/clickhouse-server/config.xml

9004

修改服務器端配置,需要重啟clickhouse, 默認日志輸出 /var/log/clickhouse-server/clickhouse-server.log

下面這種方式,需要在本地配置mysql,然后本地連接,默認省去的連接主機為localhost

[root@ch2 ~]# mysql --protocol tcp -u default -P 9004Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection idis 0Server version:20.3.9.70-ClickHouse

Copyright (c)2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracleis a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c'to clear the current input statement.

mysql>show databases;+----------+

| name |

+----------+

| default |

| system |

| test |

| tutorial |

+----------+

4 rows in set (0.01sec)

Read4 rows, 475.00 B in 0.001 sec., 3554 rows/sec., 412.20 KiB/sec.

mysql>use test;

Reading table informationforcompletion of table and column names

You can turn offthis feature to get a quicker startup with -A

Database changed

mysql>show tables;+------+

| name |

+------+

| test |

+------+

1 row in set (0.01sec)

Read1 rows, 26.00 B in 0.001 sec., 771 rows/sec., 19.60 KiB/sec.

同樣可以創建表

mysql> create table t1(id String,name String) ENGINE=TinyLog;

Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values('a01','');

Query OK, 1 row affected (0.00 sec)

Read 1 rows, 21.00 B in 0.004 sec., 275 rows/sec., 5.64 KiB/sec.

mysql> select * from t1;

+------+------+

| id | name |

+------+------+

| a01 | |

+------+------+

1 row in set (0.01 sec)

Read 1 rows, 21.00 B in 0.002 sec., 525 rows/sec., 10.78 KiB/sec.

密碼配置

為了兼容mysql客戶端,建議clickhouse使用sha1加密算法

生成密碼,這個生成命令在?/etc/clickhouse-server/users.xml?注釋部分,是官方給出的

# PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD"\> | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'yOBuWUzN

1caa12e10ba19388e98b0964eb25e93128fd0ace

刪除下面的標簽

添加新標簽

1caa12e10ba19388e98b0964eb25e93128fd0ace

再次連接,不需要重啟clickhouse

mysql --protocol tcp -u default -P 9004 --password=yOBuWUzN

去掉密碼也可以連接

mysql --protocol tcp -u default -P 9004

總結

以上是生活随笔為你收集整理的mysql clickhouse_通过mysql操作clickhouse的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。