首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在yugabyte db中创建带密码的用户、删除角色和拥有所有权的数据库?

如何在yugabyte db中创建带密码的用户、删除角色和拥有所有权的数据库?
EN

Stack Overflow用户
提问于 2020-01-20 17:53:02
回答 1查看 124关注 0票数 0

目标:在yugabyte中创建带密码的用户,删除角色和数据库

执行的命令:

代码语言:javascript
复制
cd /opt/yugabyte/yugabyte-1.3.0.0/bin
psql -h localhost -p 5433 -U postgres -d postgres -W
\i /index/yugabyte/yugastore.sql

日志:

代码语言:javascript
复制
postgres=# \i /index/yugabyte/yugastore.sql
Password for user postgres: 
psql (9.2.24, server 11.2)
WARNING: psql version 9.2, server version 11.0.
         Some psql features might not work.
You are now connected to database "postgres" as user "postgres".
psql:/index/yugabyte/yugastore.sql:9: ERROR:  database "yugastore" does not exist
psql:/index/yugabyte/yugastore.sql:11: ERROR:  DROP USER not supported yet
LINE 1: DROP USER ydba;
        ^
HINT:  See https://github.com/YugaByte/yugabyte-db/issues/869. Click '+' on the description to raise its priority
psql:/index/yugabyte/yugastore.sql:13: ERROR:  CREATE USER ROLE with element not supported yet
LINE 1: CREATE USER ydba WITH PASSWORD 'ydba123';
                              ^
HINT:  See https://github.com/YugaByte/yugabyte-db/issues/869. Click '+' on the description to raise its priority
psql:/index/yugabyte/yugastore.sql:15: ERROR:  role "ydba" does not exist

请帮助我解决这些问题!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-21 17:18:58

Download数据库:

代码语言:javascript
复制
wget https://downloads.yugabyte.com/yugabyte-2.0.10.0-linux.tar.gz
tar xvfz yugabyte-2.0.10.0-linux.tar.gz && cd yugabyte-2.0.10.0/
./bin/post_install.sh
./bin/yb-ctl create
./bin/ysqlsh

Sql代码:

代码语言:javascript
复制
yugabyte=# create database ydb;
CREATE DATABASE
yugabyte=# create user ydba WITH PASSWORD 'ydba123';
CREATE ROLE
yugabyte=# ALTER DATABASE ydb OWNER TO ydba;
ALTER DATABASE
yugabyte=# drop user ydba;
ERROR:  role "ydba" cannot be dropped because some objects depend on it
DETAIL:  owner of database ydb
yugabyte=# drop database ydb;
DROP DATABASE
yugabyte=# drop user ydba;
DROP ROLE
yugabyte=# 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59820697

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档