DX Application Performance Management

  • 1.  Postgres read Only User

    Posted Nov 16, 2017 12:55 AM

    I have a requirement to create a read only user in APMDB which is PostgreSQL database in our environment. when I am trying to create readonly only I am getting following ERRORS

     

    cemdb=> CREATE USER mcnealj;
    ERROR:  permission denied to create role
    cemdb=> \q
    [wahabak@sp-sec-stgapmdb ~]$ psql postgres admin
    Password for user admin:
    psql (8.4.20, server 9.2.9)
    WARNING: psql version 8.4, server version 9.2.
             Some psql features might not work.
    Type "help" for help.

    postgres=> CREATE USER mcnealj;
    ERROR:  permission denied to create role
    postgres=>

     

    postgres=> \du
                List of roles
     Role name | Attributes  | Member of
    -----------+-------------+-----------
     admin     |             | {}
     postgres  | Superuser   | {}
               : Create role
               : Create DB

     

     

    I try to create read only user in both ways. using postgres user and cemdb but  unsuccessful. Does any one try this before can help me ? 



  • 2.  Re: Postgres read Only User
    Best Answer

    Broadcom Employee
    Posted Nov 16, 2017 01:05 AM

    You need to connect as an administrator, so you should be connected as 'postgres' or whatever you chose when you installed the database server.

    You may find it easier to use pgAdmin to do this instead of psql.



  • 3.  Re: Postgres read Only User

    Broadcom Employee


  • 4.  Re: Postgres read Only User

    Broadcom Employee
    Posted Nov 16, 2017 01:15 AM

    It's also important to set the 'valid until' for the user account:

    PostgreSQL: Script to Create a Read-Only Database User 

    Here's my blog about this:

    Changing passwords for PostgreSQL