微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

[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=#  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐