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
个数据库,在另一个数据库中没有。
尝试 psql -h localhost -p 5433 -U uniserved_db -W uniprojectv20
端口 5433 上的群集。
要列出所有集群,请尝试 运行 pg_lsclusters
它应该显示数据目录、端口和版本
我是 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
个数据库,在另一个数据库中没有。
尝试 psql -h localhost -p 5433 -U uniserved_db -W uniprojectv20
端口 5433 上的群集。
要列出所有集群,请尝试 运行 pg_lsclusters
它应该显示数据目录、端口和版本