-bash-4.1$ psql postgres postgres -c “select pg_reload_conf();” Password for user postgres: pg_reload_conf —————- t (1 row) -bash-4.1$
允许远程连接PostgreSQL数据库
PostgreSQL的主配置文件postgresql.conf位于目录/var/lib/pgsql/9.2/data,其中CONNECTIONS AND AUTHENTICATION段中的配置如下
#—————————————————————————— # CONNECTIONS AND AUTHENTICATION #—————————————————————————— # – Connection Settings - #listen_addresses = ‘localhost’ # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to ‘localhost’, ‘*’ = all # (change requires restart) #port = 5432 # (change requires restart)
以上默认设置仅接受来自本地(Localhost)的连接,如果需要允许远程主机连接,需要将listen_addresses注释取消,并将localhost更改为*或者指定的网卡IP地址。此处还可以更改默认的监听端口5432
修改完成后,需要重新启动postgresql-9.2系统服务,重新载入配置文件后方可生效。