psql authentication fails with --host=localhost

半城伤御伤魂 提交于 2021-01-29 05:30:42

问题


With the command:

psql --dbname=mattermost --username=mmuser --password

then if I place the password it succeeds, but if I write:

psql --host=localhost --dbname=mattermost --username=mmuser --password

then the same password gives authentication fails

How can I resolve this?


回答1:


So in this one try using

 psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password

check the pg_hba.conf for further info. So if below line in your pg_hba.conf file

 host    all         all        localhost             trust

then it will start working with localhost also



来源:https://stackoverflow.com/questions/53802832/psql-authentication-fails-with-host-localhost

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!