首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Postgresql无法将角色更改为超级用户

Postgresql无法将角色更改为超级用户
EN

Stack Overflow用户
提问于 2021-02-12 01:15:08
回答 1查看 261关注 0票数 1

我在postgresql 101考试中不及格...我只想将我当前的用户catmaid更改为具有超级用户权限。

代码语言:javascript
运行
复制
(catmaid) [catmaid@sonic ~]$ psql postgres
psql (10.10)
Type "help" for help.

postgres=> \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 catmaid   |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=> alter role catmaid superuser;
ERROR:  must be superuser to alter superusers

我之所以要这样做,是因为我无法进行django迁移

代码语言:javascript
运行
复制
(catmaid) [catmaid@sonic django]$ ./projects/manage.py migrate
INFO 2021-02-11 18:12:40,155 CATMAID version 2018.11.09-1660-gce1dee4
WARNING 2021-02-11 18:12:40,806 NeuroML module could not be loaded.
WARNING 2021-02-11 18:12:41,068 CATMAID was unable to load the Rpy2 library, which is an optional dependency. Nblast support is therefore disabled.
WARNING 2021-02-11 18:12:41,068 CATMAID was unable to load the Pandas lirary, which is an optional dependency. Nblast support is therefore disabled.
INFO 2021-02-11 18:12:41,125 Spatial update events disabled
INFO 2021-02-11 18:12:41,271 History tracking enabled
System check identified some issues:

WARNINGS:
?: Couldn't check spatial update notification setup, missing database functions
        HINT: Migrate CATMAID
?: The output folder  is not writable
        HINT: Make sure the user running CATMAID can write to the output directory or change the MEDIA_ROOT setting.
Operations to perform:
  Apply all migrations: admin, auth, authtoken, catmaid, contenttypes, guardian, performancetests, pgcompat, sessions, sites, taggit
Running migrations:
  Applying catmaid.0058_add_pg_trgm_ext_and_class_instance_name_index...Traceback (most recent call last):
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.InsufficientPrivilege: permission denied to create extension "pg_trgm"
HINT:  Must be superuser to create this extension.
EN

回答 1

Stack Overflow用户

发布于 2021-02-12 01:50:09

我欺骗自己,认为我实际上是用户postgres。@iklinac和@Frank N Stein在评论中指出,我不得不把自己交给postgres。

代码语言:javascript
运行
复制
(catmaid) [catmaid@sonic django]$ su - postgres
-bash-4.2$ psql -U postgres
psql (10.10)
Type "help" for help.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 catmaid   |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=# alter role catmaid superuser;
ALTER ROLE
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 catmaid   | Superuser                                                  | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

所以功劳归功于他们,谢谢!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66159502

复制
相关文章

相似问题

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