我知道有大量的帖子与密切的消息。我读过所有希望。并没有找到答案。一些提议使用-h localhost
从local
跳转到host
规则hba.conf
。有人说设置trust
在local
...但我想peer
身份验证,而不是TCP
而不是信任!Postgres - 同行认证 - psql:致命:角色“xxxx”不存在
,所以我有两个OS
和DB
用户VAO:
t=# \! who am i
vao pts/8 2016-11-11 12:23 (10.1.10.158)
t=# \du+ vao
List of roles
Role name | Attributes | Member of | Description
-----------+------------+-----------+-------------
vao | Superuser | {} |
,然而当我尝试给psql我得到错误:
$ psql t
psql: FATAL: role "vao" does not exist
根据docs
The peer authentication method works by obtaining the client's operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.
和
Peer authentication is only available on operating systems providing the getpeereid() function, the SO_PEERCRED socket parameter, or similar mechanisms. Currently that includes Linux, most flavors of BSD including OS X, and Solaris.
所以我看,如果Debian支持getpeereid() 或SO_PEERCRED并拼命挖掘解释。
直到我重新评估我明显缺乏环境设置。如果psql里没有找到用户,也许它没有找到一个socket
.. 所以我检查unix_socket_directories
在postgresql.conf
并根据 psql的手册:
--host=hostname Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.
尝试psql t -h '/path/to/unix_socket_directories'
,瞧 - 我在那里
而且这不是我第一次踩这个耙子! 所以我把它张贴在这里 - 希望它能帮助别人。