Rails: PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations

前端 未结 6 677
慢半拍i
慢半拍i 2021-02-07 01:48

I\'m trying to create the database in Rails. In Postgres I see the development and test database, however, I\'m getting a permissions error. I\'ve tried to follow this link, did

6条回答
  •  被撕碎了的回忆
    2021-02-07 02:15

    I had same issue and I solved by adding "Superuser" to the role.

    First, list users and their privileges. If you followed above commands, root user does not have "Superuser" Attributes.

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

    Next, upgrade root to be a "Superuser".

    postgres=# ALTER USER root WITH SUPERUSER;
    ALTER ROLE
    

    Again, list users and their privileges. Now root has "Superuser".

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

    Hope it helps.

提交回复
热议问题