繁体   English   中英

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

[英]Postgres : psql: FATAL: database “uniprojectv20” does not exist

我是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

您必须在同一台计算机上具有多个postgres集群。 因此,您在一个数据库中拥有uniprojectv20数据库,而在另一个数据库中则没有。

对于端口5433上的群集,请尝试使用psql -h localhost -p 5433 -U uniserved_db -W uniprojectv20

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM