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

QueXuQ · April 27, 2015 · Last by JeskTop replied at April 29, 2015 · 3062 hits

基本上配置 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
You need to Sign in before reply, if you don't have an account, please Sign up first.