我正在尝试登录我的数据库并收到此错误...
root@---:~# psql -U user database
psql: FATAL: Peer authentication failed for user "user"
Run Code Online (Sandbox Code Playgroud)
这是什么意思?我很确定我可以通过将 peer 放入我的 pg_hba.conf 来修复它,但我不确定我是否应该这样做......
我正在运行山狮,当我运行psql
orpostgres
命令时,我得到了非常不同的响应。
对于前者,我得到:
> psql
ovatsug25=#
Run Code Online (Sandbox Code Playgroud)
对于后者,我得到:
> postgres
postgres does not know where to find the server configuration file.
Run Code Online (Sandbox Code Playgroud)
您必须指定--config-file
或-D
调用选项或设置PGDATA
环境变量。
我通过自制软件安装了 postgres 并运行
rm /usr/bin/psql
Run Code Online (Sandbox Code Playgroud)
这样做之后。
我的主要问题已修复(Rails 启动并连接到数据库),但我不确定这些命令之间的区别在哪里或如何发生。在此期间仍在试图弄清楚面包......我很感激任何帮助。
他们的位置
which psql
/usr/local/bin/psql
Run Code Online (Sandbox Code Playgroud)
和哪个postgres
which postgres
/usr/local/bin/postgres
Run Code Online (Sandbox Code Playgroud) postgresql ×2