postgres 用户登录问题
資深大佬 : zxCoder 0
系统是 ubuntu20.04 ,按照官网,通过添加软件源,然后安装 postgres,然后默认有个 postgres 用户,然后我先sudo su - postgres
切换到这个用户,然后psql
直接进入,然后修改密码,之后退出,切换回我自己的另一个 linux 用户test
,然后在这个 test 用户这里,使用psql -U postgres
无法进入,显示psql: error: FATAL: Peer authentication failed for user "postgres"
,比如指定psql -U postgres -h localhost
才可以,或者设置环境变量PGHOST
,这是为什么呢?
没搜到相关的东西啊,看很多教程也没有提到这个
大佬有話說 (8)