Postgres的:PSQL:FATAL:数据库“uniprojectv20”不存在

问题描述:

我是新来的Pos​​tgreSQL,我在我的计算机上安装的Postgres和创建数据库名为uniprojectv20,也可以创建用户名为uniserved_db并授予所有的访问数据库uniprojectv20。如果我试图从另一个用户,而不是我面临同样的问题Postgres的连接Postgres的:PSQL:FATAL:数据库“uniprojectv20”不存在

[email protected] ~ $ 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 
[email protected] ~ $ psql -h localhost -p 5432 -U uniserved_db -W uniprojectv20 
Password for user uniserved_db: 
**psql: FATAL: database "uniprojectv20" does not exist** 
[email protected] ~ $ psql uniprojectv20 
psql (9.6.3) 
Type "help" for help. 

uniprojectv20=# 

另外:我取以下问题。

[email protected] ~ $ psql -h localhost -p 5432 -U uniserved_db -W uniprojectv20 
Password for user uniserved_db: 
psql: FATAL: database "uniprojectv20" does not exist 
+0

请运行'显示端口;''在psql' –

+0

'的Postgres =#show port; 端口 ------ (1行)' –

+0

如此然后尝试连接'的psql -h本地主机-p 5433 -U uniserved_db -W uniprojectv20'?.. –

你必须在同一台机器上有几个postgres集群。所以你有一个uniprojectv20数据库,而不是其他。

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

要列出所有集群,尝试运行pg_lsclusters它应该显示的数据显示目录,港口以及版本