加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL学习第五篇--本机psql设置需要/不需要密码

发布时间:2020-12-13 17:00:56 所属栏目:百科 来源:网络整理
导读:[postgres@single ~]$ psqlpsql (9.6.1)Type "help" for help.postgres=#无需输入密码,可以修改pg_hba.conf文件来要求输入密码。设置完成后需要重启之后生效。以下为设置不需要密码的情况:[postgres@single pgdata]$ vi pg_hba.conf# "local" is for Unix
[postgres@single ~]$ psql
psql (9.6.1)
Type "help" for help.

postgres=#
无需输入密码,可以修改pg_hba.conf文件来要求输入密码。
设置完成后需要重启之后生效。

以下为设置不需要密码的情况:

[postgres@single pgdata]$ vi pg_hba.conf
# "local" is for Unix domain socket connections only
local   all             all                                   trust
# IPv4 local connections:
host    all             all             127.0.0.1/32          trust
"pg_hba.conf" 93L,4466C written                                                                                                                                                                                         
[postgres@single pgdata]$ psql
Password:
psql: fe_sendauth: no password supplied
[postgres@single pgdata]$ pg_ctl stop
LOG:  received fast shutdown request
LOG:  aborting any active transactions
LOG:  autovacuum launcher shutting down
LOG:  shutting down
waiting for server to shut down....LOG:  database system is shut down
 done
server stopped  
[postgres@single pgdata]$ pg_ctl start
server starting
[postgres@single pgdata]$ LOG:  database system was shut down at 2016-11-17 16:54:37 CST
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

[postgres@single pgdata]$ psql
psql (9.6.1)
Type "help" for help.

postgres=#  

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读