我忘记了postgresql root用户的密码:postgres
所以我改变了pg_hba.conf来拥有一切的trust方法(这是我的本地开发框)
local all postgres trust local all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust
重新启动服务后,它仍然要求我input密码。
@omnipresent:~$ su - postgres Password: su: Authentication failure
虽然,我可以通过psql -U postgreslogin
@omnipresent:~$ psql -U postgres psql (8.4.8) Type "help" for help. postgres=#
我在这里混乱,在这一点上,我只想为postgresql做一个新的angular色,并使该用户成为一个pipe理员。
在这种情况下我怎么能这样做呢?
要更改任何Linux用户的密码,包括Postgres根目录:
sudo passwd postgres
然后:
su - postgres psql -U postgres template1 -c alter user postgres with password 'newpassword';