postgresql - 用户 "postgres"的对等身份验证失败

标签 postgresql psql pg-hba.conf

我一直在使用 postgreSQL,尝试使用命令转储普通备份文件:

psql -U postgres DATABASE < path to file.backup

但是获取对等身份验证失败。甚至尝试将 pg_hba.confpeer 更改为 md5,但没有成功。

最佳答案

peer 表示您不是 OS 用户 postgres,同时尝试作为一个连接,

  1. sudo su - postgres
  2. 然后是psql DBNAME >file.sql

https://www.postgresql.org/docs/current/static/auth-methods.html#AUTH-PEER

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.

关于postgresql - 用户 "postgres"的对等身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44650783/

相关文章:

arrays - 如何在 SQL 中检查整数数组类型的单元格是否包含某个值

postgresql - PostgreSQL Entity Framework 上的 RowVersion 实现

postgresql - 如何使用 psql 处理大型结果集?

postgresql - EXECUTE 的查询字符串参数为空

postgresql - 在 postgresql : How do I create a simple counter which I can reset?

mysql - gitlab 健康检查不健康

postgresql - psql - 读取 SQL 文件并输出到 CSV

postgresql pg_hba - 可以使用多个本地线路吗?

macos - 连接被拒绝 - 服务器是否在本地运行并接受