1确保您已将postgres密码设置为您知道的密码:
[###@EMOO ~]$ sudo -u postgres ./psql
psql (9.6.3)
Type "help" for help.
postgres=# ALTER ROLE postgres WITH PASSWORD ‘postgres password‘;
2找到你的pg_hba.conf
sudo updatedb
sudo locate pg_hba.conf
3在pg_hba.conf中将“trust”替换为“md5”
4重新启动postgresql:
sudo systemctl restart postgresql
5登录为postgres并更改您需要的任何用户密码,如果用户没有提供正确的密码,
sudo -u postgres ./psql