Postgres:psql:致命:数据库“uniprojectv20”不存在

时间:2017-05-25 07:05:04

标签: postgresql postgres-9.6

我是postgresql的新手,我在我的计算机上安装了postgres并创建了名为uniprojectv20的数据库,并创建了名为uniserved_db的用户并授予对数据库uniprojectv20的所有访问权限。我正在提出以下问题:

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=# 

此外,如果我尝试连接其他用户而不是postgres,我面临同样的问题。

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

1 个答案:

答案 0 :(得分:2)

您必须在同一台计算机上安装多个postgres群集。所以你有一个uniprojectv20数据库,而不是其他数据库。

在端口5433上尝试psql -h localhost -p 5433 -U uniserved_db -W uniprojectv20群集。

要列出所有群集,请尝试运行pg_lsclusters它应显示数据目录,端口和版本

相关问题