Dav*_*ave 6 postgresql permissions psql password
我在 Debian Linux 上使用 Postgres 9.4。我用一个用户创建了一个数据库,cindex可以访问该数据库。然而,当我尝试在命令行登录时,我什至没有提示输入密码:
myuser@myuserserver:~ $ psql -Ucindex cindex
psql: FATAL: Peer authentication failed for user "cindex"
Run Code Online (Sandbox Code Playgroud)
我还需要做什么来启用用户?下面你可以看到我已经设置的权限:
postgres@myuserserver:~$ psql
psql (9.4.13)
Type "help" for help.
postgres=# GRANT SELECT ON ALL TABLES IN SCHEMA cindex TO cindex;
GRANT
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
cindex | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =T/postgres +
| | | | | postgres=CTc/postgres+
| | | | | cindex=c/postgres
postgres | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 |
template0 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
cindex | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6237 次 |
| 最近记录: |