今天下午 陷进去了 其实很简单的一个事情结果浪费了 接近一个小时. 做事情必须要细致一些. 自己的确做的不好.
这里面简单说一下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 用户的话 不需要输入密码就可以登录了 能够直接修改密码...
其他配置文件都是一样的.