当前位置:网站首页>[Clickhouse column] create a new library, user and role
[Clickhouse column] create a new library, user and role
2022-06-11 16:43:00 【Alphabet brother】
List of articles
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 restart
3、 ... 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;'
acaidb
Recommended reading
边栏推荐
- 多任务学习经典品读:MMoE模型篇
- Simulated 100 questions and simulated examination for main principals of hazardous chemical business units in 2022
- Oracle生成不重复字符串 sys_guid()与Mysql生成唯一值
- Wechat applet timestamp conversion time format + time subtraction
- Detailed explanation of the functions of list and dict data types
- RSP:遥感预训练的实证研究
- 2022 molten welding and thermal cutting work license and simulation examination
- Research Report on operation mode and investment opportunities of China's aluminum industry 2022-2028
- ASP.NET教育OA系统源码 教育行业OA系统源码带文档
- 【opencvsharp】opencvsharp_ samples. Core sample code Notes
猜你喜欢

学生网站模板棕色蛋糕甜品网站设计——棕色蛋糕甜品店(4页) 美食甜品网页制作期末大作业成品_生鲜水果网页设计期末作业

Go quick start of go language (I): the first go program

ShellBrowser .NET Crack

Weekly recommended short video: rookie CEO talks about the new logistics track in the future

LeetCode——24. 两两交换链表中的节点(三指针)

^31原型面试题

How unittest knows the execution time of each test case

2022g1 industrial boiler stoker test questions and simulation test

web网页设计实例作业 ——河南美食介绍(4页) web期末作业设计网页_甜品美食大学生网页设计作业成品

从0到1了解Prometheus
随机推荐
Rdkit installation
2022安全员-A证考试题模拟考试题库模拟考试平台操作
Kernel density estimation (2D, 3D)
RSP:遥感预训练的实证研究
Analysis report on future development trend and investment suggestions of global and Chinese soybean protein industry 2022-2028
Katalon Studio Enterprise
Pyqt5 enables the qplaintextedit control to support line number display
solr(一)solr的安装及权限控制
What is a generic? Why use generics? How do I use generics? What about packaging?
Memory image of various data types in C language
(验证文件)validateJarFile...报错
Persistence mechanism of redis
数据库备份(Mysql)
Differences between list and set access elements
Ruiji takeout project (III) employee management business development
[learn FPGA programming from scratch -17]: quick start chapter - operation steps 2-5- VerilogHDL hardware description language symbol system and program framework (both software programmers and hardwa
If you want to learn ArrayList well, it is enough to read this article
Web security - shooting range notes
Exception handling and exception usage in golang
solr(二)solr添加core以及依赖包路径