当前位置:网站首页>[Clickhouse column] user initialization of new library role
[Clickhouse column] user initialization of new library role
2022-06-12 03:41:00 【Letter brother blog】
One 、 Create a new database
clickhouse The syntax for creating a database is almost the same as other relational databases , The difference is clickhouse Cluster exists cluster And library engine engine The concept of , You can specify as needed . If there is no special need , The default can be .
CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)] When creating a database , We first need to confirm the directory where the database files are saved , about clickhouse The user has read and write permission . If you install , The database file directory has not been modified , The default directory is /var/lib/clickhouse/. We can use the following command , Change the owner of this directory and its subdirectories to clickhouse user .
chown clickhouse /var/lib/clickhouse/ -R After completing the above steps , You can go through clickhouse-client -m --password < Your password > Connect clichouse Service instance , Create database's SQL as follows :
:) CREATE DATABASE acaidb; After creating the database , Use show databases; Command to see the current clickhouse, What are they? database.(acaidb We built it ourselves ,default and system yes clickhouse Created by default database)
:) show databases;┌─name────┐│ acaidb ││ default ││ system │└─────────┘Two 、 by default Add management authority to the account
ClickHouse Create a database by default default, A user is created by default default. We are now targeting default Users increase access management permission , Because the user does not have administrator permission by default , namely : By default , Cannot add role with this user 、 Add users 、 And other permission management operations .
So in order for default Users have more administrative authority , We modify /etc/clickhouse-server/users.xml file , stay users-> default In the label , take access_management Remove comments from .( In some versions, the default value is 0, It is amended as follows 1) 
After modifying the configuration file , restart clickhouse-server, Use the following command :
clickhouse restart3、 ... and 、 Create roles and users
Create the role
Create a character acaidb_rw, This role is for the database acaidb Read and write permission .
CREATE ROLE acaidb_rw;GRANT SELECT, INSERT, ALTER UPDATE, ALTER DELETE ON acaidb.* TO acaidb_rw;If you let a role only allow select, Data modification is not allowed , The following statement can .
CREATE ROLE acaidb_read;GRANT SELECT ON acaidb.* TO acaidb_read;Create general accounts and empower
We create accounts separately reader and writer, Then put the read-only role ro Assigned to reader, Assign the read-write role to writer. such ,reader Have read-only permission ,writer Have read and write access . Create a new database user acai, And set the password ( What follows is < Your password > Replace ). And give it to the user acai Assign read and write permission roles acaidb_rw .
CREATE USER IF NOT EXISTS acai IDENTIFIED WITH sha256_password BY '< Your password >';GRANT acaidb_rw TO acai; Use the following command to access clickhouse data ,show databases obtain acaidb, It shows that we have succeeded in . because acai Users can only access acaidb.
# clickhouse-client -m -u acai --password '< Your password >' --query 'show databases;'acaidbRecommended reading
边栏推荐
- What is the core of Web3?
- MySQL的check约束数字问题
- Special materials | household appliances, white electricity, kitchen electricity
- 2020-12-17
- PostMessage implements window communication
- FOB,CIF,CFR的区别是什么?
- Solution en cas de défaillance du script Unity
- KV storage separation principle and performance evaluation of nebula graph
- Goodbye to excel and PPT, I found a better visual fool software
- [Yugong series] March 2022 asp Net core Middleware - current limiting
猜你喜欢

字符串处理:
![What is a request response pair called? [repeat] - what is a request response pair called? [duplicate]](/img/65/a214d137e230b1a1190feb03660f2c.jpg)
What is a request response pair called? [repeat] - what is a request response pair called? [duplicate]
![Leetcode 6[finding rules] Z-transform the leetcode path of heroding](/img/c0/aca2eb185ce4b423df9ee171ee91e1.jpg)
Leetcode 6[finding rules] Z-transform the leetcode path of heroding

Mongodb essence summary
![[C language] dynamic memory allocation](/img/ac/ba3882c76f93dde0ab0d5294c5b6d9.jpg)
[C language] dynamic memory allocation

Cloud native overview

An example of how to migrate the stock equipment of the Internet of things platform to the enterprise version with one click

Steamvr--- grab objects

Solution en cas de défaillance du script Unity

Special information | liquor (Baijiu, beer, wine)
随机推荐
3768 string pruning (double pointer)
[DFS "want" or "don't"] seek subsets; Seeking combination
In 2022, don't you know the difference between arrow function and ordinary function?
PyTorch中的Sequential、ModuleList和ModuleDict用法总结
Final summary of addition, deletion, modification and query - 2.1 (single table - addition, deletion, modification and query)
Experience the good team collaborative development process brought by Huawei cloud code hosting from 0 [my Huawei cloud experience journey] [play with Huawei cloud]
Pat class B 1067 trial password (20 points)
Sequence list and linked list - primary level
Implementation of fitness club management system based on SSH
Youcans' opencv lesson - 10 Image restoration and reconstruction
2020-12-07
Review of technical economy and Enterprise Management Chapter 4
CA證書及密鑰對應用筆記
Leetcode 6[finding rules] Z-transform the leetcode path of heroding
[data recovery in North Asia] data recovery in which the logical volume of the server is changed and the file system is damaged due to system reinstallation
基于SSH实现健身俱乐部管理系统
R语言plotly可视化:plotly可视化分组(grouped)小提琴图(grouped violin plot in R with plotly)
[Yugong series] March 2022 asp Net core Middleware - conditional routing
消息队列概述
[Yugong series] March 2022 asp Net core Middleware - current limiting