pgsql问题记录

1.pgsql查看状态提示:

postgresql-9.5 dead but pid file exists

先输入:ps -auxf|grep postgres 查看Postgres这个用户在使用哪些进程

将查到的进程kill

再/var/run下面的postgresql-9.5 删除

再将/var/lock/subways下面的postgresql-9.5.sock删除,再启动postgresql


2. pgsql 设置远程访问

1.修改pg_hba.conf文件,配置用户的访问权限(#开头的行是注释内容):

# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.1.0/24 md5
# IPv6 local connections:
host all all ::1/128 trust

其中,第7条是新添加的内容,表示允许网段192.168.1.0上的所有主机使用所有合法的数据库用户名访问数据库,并提供加密的密码验证。

其中,数字24是子网掩码,表示允许192.168.1.0--192.168.1.255的计算机访问!