Cha*_*Pye 14 database postgresql
我在CentOS服务器上成功安装了PostgreSQL服务器8.4.之后,我使用'postgres'用户登录CentOS服务器,但我无法运行任何命令,出现错误:
用户"postgres"的密码验证失败
以下是pg_hba.conf和postgresql.conf中的一些配置:
--------------------configuration in postgresql.conf-----------
listen_addresses = '*'
--------------------configuration in pg_hba.conf---------------
local all all md5
local all postgres md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
Run Code Online (Sandbox Code Playgroud)
Ber*_*rak 15
我倾向于在pg_hba.conf中使用以下内容:
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
Run Code Online (Sandbox Code Playgroud)
这意味着,一旦你"postgres",你不需要密码,但你需要sudo权利才能成为postgres,所以这非常安全.任何其他用户都可以使用简单的md5身份验证登录,这意味着您不必在所有地方进行sudo.这对我很有用.
Dan*_*iel 11
确保使用postgres PostgreSQL帐户的密码,而不是postgres系统帐户.在pg_hba.conf中尝试"trust"而不是"md5"来连接到db并更改你的传递.
我遇到了类似的问题(相同的错误消息).就像丹尼尔回答一样,这是因为我混淆了:
"postgres PostgreSQL帐户,而不是postgres系统帐户."
要确保postgres密码,只需将其更改为"123456"(或任何其他密码)
# su postgres
# psql -d template1
template1=# ALTER USER postgres WITH PASSWORD '123456';
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
54845 次 |
最近记录: |