且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

psql:严重:用户“ dev”的对等身份验证失败。

更新时间:2022-03-04 21:23:07

尝试:

psql -U user_name  -h 127.0.0.1 -d db_name

其中


  • -U 是数据库用户名

  • -h 是本地服务器的主机名/ IP,从而避免使用Unix域套接字

  • -d 是要连接到的数据库名称

  • -U is the database user name
  • -h is the hostname/IP of the local server, thus avoiding Unix domain sockets
  • -d is the database name to connect to

然后进行评估作为Postgresql的网络连接,而不是Unix域套接字连接,因此不评估为您可能会在 pg_hba.conf 中看到本地连接:

This is then evaluated as a "network" connection by Postgresql rather than a Unix domain socket connection, thus not evaluated as a "local" connect as you might see in pg_hba.conf:

local   all             all                                     peer