用户 "postgres" 的对等身份验证失败
Peer authentication failed for user "postgres"
我一直在使用 postgreSQL,尝试使用以下命令转储普通备份文件:
psql -U postgres DATABASE < path to file.backup
但是获取对等身份验证失败。甚至尝试将 pg_hba.conf
从 peer
更改为 md5
,但没有成功。
peer
表示您不是 OS 用户 postgres,在尝试连接时,
sudo su - postgres
- 然后是
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,尝试使用以下命令转储普通备份文件:
psql -U postgres DATABASE < path to file.backup
但是获取对等身份验证失败。甚至尝试将 pg_hba.conf
从 peer
更改为 md5
,但没有成功。
peer
表示您不是 OS 用户 postgres,在尝试连接时,
sudo su - postgres
- 然后是
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.