Omn*_*ent 4 postgresql ubuntu-11.04
我忘记了 postgresql 根用户的密码: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
Run Code Online (Sandbox Code Playgroud)
重新启动服务后,它仍然要求我输入密码。
@omnipresent:~$ su - postgres
Password:
su: Authentication failure
Run Code Online (Sandbox Code Playgroud)
虽然,我可以登录 psql -U postgres
@omnipresent:~$ psql -U postgres
psql (8.4.8)
Type "help" for help.
postgres=#
Run Code Online (Sandbox Code Playgroud)
我陷入了困境,此时我只想为 postgresql 创建一个新角色并使该用户成为管理员。
在这种情况下我该怎么做?
要更改任何 linux 用户的密码,包括 Postgres 根:
sudo passwd postgres
Run Code Online (Sandbox Code Playgroud)
然后:
su - postgres
psql -U postgres template1 -c alter user postgres with password 'newpassword';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4057 次 |
| 最近记录: |