Still havent understood the basics !!! The username "postgres" created initially, immediately after installation, allows me to log in. But later I added a new user "p2" with the password "123". When I try to login using the p2 username it doesnt work. I dont know if I am following the right steps, please guide.
revoltman@G41:~$ service postgresql start
revoltman@G41:~$ sudo -u postgres -i
postgres@G41:~$ exit
logout
revoltman@G41:~$ sudo -u p2 -i
sudo: unknown user: p2
sudo: unable to initialize policy plugin
Earlier I had created the new user :
postgres@G41:~$ createuser -P -s -e p2
Enter password for new role:
Enter it again:
CREATE ROLE p2 PASSWORD 'md576be8f31b92b38740013f11b102caa1c'
SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
postgres@G41:~$ sudo -u p2 -i
sudo: unknown user: p2
sudo: unable to initialize policy plugin
If I type \du in psql to find list of all users :
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-
p1 | | {}
p2 | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
Am I creating new user in a wrong way or my login method is wrong ? If you want to know any other details please ask.