I am new to postgresql , I Have install postgres in my computer and create database called uniprojectv20
and also create user called uniserved_db
and grant all the access to database uniprojectv20
. I am fetching following problem:
rahul@HP-EliteBook ~ $ psql -V
psql (PostgreSQL) 9.6.3
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+--------------+----------+---------+-------+-------------------------------
postgres | postgres | UTF8 | en_IN | en_IN |
rahul | postgres | UTF8 | en_IN | en_IN |
template0 | postgres | UTF8 | en_IN | en_IN | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_IN | en_IN | =c/postgres +
| | | | | postgres=CTc/postgres
uniprojectv20 | uniserved_db | UTF8 | en_IN | en_IN | =Tc/uniserved_db +
| | | | | uniserved_db=CTc/uniserved_db
(5 rows)
postgres=# \q
postgres@HP-EliteBook ~ $ psql -h localhost -p 5432 -U uniserved_db -W uniprojectv20
Password for user uniserved_db:
**psql: FATAL: database "uniprojectv20" does not exist**
postgres@HP-EliteBook ~ $ psql uniprojectv20
psql (9.6.3)
Type "help" for help.
uniprojectv20=#
Also If I tried to connect from another user instead of postgres I am facing same problem .
rahul@HP-EliteBook ~ $ psql -h localhost -p 5432 -U uniserved_db -W uniprojectv20
Password for user uniserved_db:
psql: FATAL: database "uniprojectv20" does not exist
You must have several postgres clusters on same machine. So you have uniprojectv20
database in one, and not in other.
try psql -h localhost -p 5433 -U uniserved_db -W uniprojectv20
for cluster on port 5433.
To list all clusters, try running pg_lsclusters
it should show data dirs, ports and versions