I'm very new to postgresql, I installed it on my windows machine, and created a few databases and users, and I'm trying to connect with one of the accounts I created. If I log in using the postgres account, and I list all users, I get the following:
postgres=# \du
List of roles
Role name | Attributes | Member of
----------------+------------------------------------------------------------+------------------
oak_admin | Superuser, Create DB | {}
oak_admin_r | Cannot login | {}
oak_test_roles | Password valid until infinity | {}
oak_test_user | Password valid until infinity | {oak_test_roles}
oak_user | | {}
oak_user_roles | Password valid until infinity | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
now I listed all the databases, and I got the following:
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-----------------------------+-----------------------------+-----------------------
oakdb | postgres | UTF8 | English_United Kingdom.1252 | English_United Kingdom.1252 |
postgres | postgres | UTF8 | English_United Kingdom.1252 | English_United Kingdom.1252 |
template0 | postgres | UTF8 | English_United Kingdom.1252 | English_United Kingdom.1252 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | English_United Kingdom.1252 | English_United Kingdom.1252 | =c/postgres +
| | | | | postgres=CTc/postgres
testdb | postgres | UTF8 | English_United Kingdom.1252 | English_United Kingdom.1252 |
(5 rows)
With that I thought I had the users and I had the databases, so I should be able to connect. So I thought maybe I mistyped the password, so I altered the password to something very easy and tried that out, I got the following error:
postgres=# ALTER USER oak_admin WITH PASSWORD 'very_easy';
ALTER ROLE
postgres=# \q
C:\Users\charb>psql -U oak_admin
Password for user oak_admin:
psql: FATAL: database "oak_admin" does not exist
Any ideas what am I doing wrong?