clickhouse - 如何为 Clickhouse 设置管理员帐户?
问题描述
我在 Windows 主机上的 docker 容器中运行 Clickhouse。我试图创建一个帐户以使其成为管理员帐户。看起来默认用户没有创建其他帐户的权限。如何解决此错误并创建管理员帐户?
docker-compose exec -T dash-clickhouse clickhouse-client --query="CREATE USER 'foo' IDENTIFIED WITH sha256_password BY 'bar'"
给出了错误
Received exception from server (version 20.7.2):
Code: 497. DB::Exception: Received from localhost:9000. DB::Exception: default: Not enough privileges. To execute this query it's necessary to have the grant CREATE USER ON *.*.
解决方案
要修复它需要access_management
在文件中启用 -setting users.xml
:
# execute an interactive bash shell on the container
docker-compose exec {container_name} bash
# docker exec -it {container_name} bash
# install preferable text editor (i prefer using 'nano')
apt-get update
apt-get install nano
# open file users.xml in the editor
nano /etc/clickhouse-server/users.xml
取消注释用户的access_management
-settingdefault
并保存更改:
..
<!-- User can create other users and grant rights to them. -->
<!-- <access_management>1</access_management> -->
..
推荐阅读
- flutter - Flutter cognito 插件发布版本
- swift - Swift Xib UiView BottomSheet 被多次调用
- html - 我的第一个 Jnr Web Dev 面试前挑战 - 请提供建议
- python - Python:找到最大元素的最快方法是小于给定值的DS然后将其删除
- javascript - 如何在函数外访问 JavaScript 函数的输出?
- eval - 我网站上 Adblock eval 的 CORS 问题
- javascript - 如何在 nodejs 中安装 npm openlpr
- javascript - 样式化组件中的样式化反应组件
- c# - iOS 子视图都集中在内容视图的顶部(使用 Cirrious FluentLayouts)
- r - 计算同时满足两个条件的行数