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