zoukankan      html  css  js  c++  java
  • Postgresql 密码设置

    今天下午 陷进去了 其实很简单的一个事情结果浪费了 接近一个小时. 做事情必须要细致一些. 自己的确做的不好.

    这里面简单说一下pg_hba.conf 和 postgresql 密码的一些设置问题.

    1. windows 机器

    安装pg 时 有一个 让输入密码的地址 这个 直接输入密码就可以了. 

    然后如果想修改密码的话 可以在命令行里面处理.:

     然后修改 data 目录下面的 : pg_hba.conf

     注意里面的配置文件内容:

    The first field is the connection type: "local" is a Unix-domain
    socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
    "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
    plain TCP/IP socket.
    
    DATABASE can be "all", "sameuser", "samerole", "replication", a
    database name, or a comma-separated list thereof. The "all"
    keyword does not match "replication". Access to replication
    must be enabled in a separate record (see example below).
    
    USER can be "all", a user name, a group name prefixed with "+", or a
    comma-separated list thereof.  In both the DATABASE and USER fields
    you can also write a file name prefixed with "@" to include names
    from a separate file.
    
    ADDRESS specifies the set of hosts the record matches.  It can be a
    host name, or it is made up of an IP address and a CIDR mask that is
    an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
    specifies the number of significant bits in the mask.  A host name
    that starts with a dot (.) matches a suffix of the actual host name.
    Alternatively, you can write an IP address and netmask in separate
    columns to specify the set of hosts.  Instead of a CIDR-address, you
    can write "samehost" to match any of the server's own IP addresses,
    or "samenet" to match any address in any subnet that the server is
    directly connected to.
    
    METHOD can be "trust", "reject", "md5", "password", "scram-sha-256",
    "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert".
    Note that "password" sends passwords in clear text; "md5" or
    "scram-sha-256" are preferred since they send encrypted passwords.
    
    OPTIONS are a set of options for the authentication in the format
    NAME=VALUE.  The available options depend on the different
    authentication methods -- refer to the "Client Authentication"
    section in the documentation for a list of which options are
    available for which authentication methods.
    
    Database and user names containing spaces, commas, quotes and other
    special characters must be quoted.  Quoting one of the keywords
    "all", "sameuser", "samerole" or "replication" makes the name lose
    its special character, and just match a database or username with
    that name.
    
    This file is read on server startup and when the server receives a
    SIGHUP signal.  If you edit the file on a running system, you have to
    SIGHUP the server for the changes to take effect, run "pg_ctl reload",
    or execute "SELECT pg_reload_conf()".
    
    Put your actual configuration here

     2. linux机器的话 也不复杂

    而且 postgres 用户的话 不需要输入密码就可以登录了 能够直接修改密码...

    其他配置文件都是一样的.

  • 相关阅读:
    2018年奇虎360春招笔试题--玫瑰花
    MaxPooling的作用
    网易笔试编程题:被3整除
    网易笔试编程题:牛牛找工作
    剑指offer 第十二天
    算法题:合并N个长度为L的有序数组为一个有序数组(JAVA实现)
    十分钟看懂神经网络反向传输算法
    十大经典排序算法最强总结(含JAVA代码实现)
    记服务器中招挖矿病毒排查过程(解决方案篇)
    spring 事件监听同时支持同步事件及异步事件
  • 原文地址:https://www.cnblogs.com/jinanxiaolaohu/p/10371009.html
Copyright © 2011-2022 走看看