新手问题 PostgreSQL 里的 peer 和 md5 区别是什么?

QueXuQ · 2015年04月27日 · 最后由 JeskTop 回复于 2015年04月29日 · 3058 次阅读

基本上配置 postgresSQL 和 Rails 的文章,都会告诉你,要把原来vim /etc/postgresql/9.4/main/pg_hba.conf里面的 peer 修改成 md5

不知道 peer 和 md5 的区别是什么呢?既然 peer 那么不方便,为什么不直接默认就是 md5 呢?

peer 只能连本地的,和用户名相同的数据库……是可以直接连的……反而很方便……

但是你肯定要新建一个数据库吧……

#1 楼 @kabie 哦,那意思是,如果用户为 abc,如果是 peer,那就可以直接链接属于 abc 的数据库了?那所以如果不仅仅是直接连的用户,那就必须要设置为 md5,对吧?

Authentication methods details:

trust - anyone who can connect to the server is authorized to access the database

peer - use client's operating system user name as database user name to access it.

md5 - password-base authentication
需要 登录 后方可回复, 如果你还没有账号请 注册新账号