Creating user with password or changing password doesn't work in PostgresQL

10,238

It looks like the user doesn't actually exist. Try using adduser test to create the passwd entry

Share:
10,238

Related videos on Youtube

mpartan
Author by

mpartan

Updated on September 18, 2022

Comments

  • mpartan
    mpartan over 1 year

    I'm trying to create a new user role or change existing one's password to be able to work locally with PostgresQL. I'm working on Ubuntu.

    I can modify the attributes of an user, but for some reason it doesn't change the password. Here are the commands I've located from different instructions that to my knowledge should work.

     sudo -u postgres psql
     psql (9.3.4, server 9.2.5)
     postgres=# CREATE USER test WITH PASSWORD 'test123';
     CREATE ROLE
     postgres=# ALTER USER test SUPERUSER CREATEDB;
     ALTER ROLE
     postgres=# \du
                             List of roles
     Role name |                   Attributes                   | Member of 
     -----------+------------------------------------------------+-----------     
     postgres  | Superuser, Create role, Create DB, Replication | {}
     test      | Superuser, Create DB                           | {}
    

    After which I try to login using

     su - test
    

    Which says

    No passwd entry for user 'test'
    

    If I try to change the password using

    postgres=# ALTER USER test WITH PASSWORD 'test321';
    ALTER ROLE
    

    It still says

    No passwd entry for user 'test'
    

    I guess I'm missing something, but how could I fix this and be able to create users? Or am I doing everything terribly wrong :)

    Thanks for all the answers

  • mpartan
    mpartan almost 10 years
    Thanks, I didn't realize you actually needed that for Postgres as well... Well, got it working now, thanks :)