安裝(Installation)‎ > ‎GNU/Linux‎ > ‎

Remote Connection

in Debian:

vi /etc/postgresql/8.x/main/postgresql.conf
# - Connection Settings -

listen_addresses = '*'        # what IP address(es) to listen on;
#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)
max_connections = 100            # (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).  You might
# also need to raise shared_buffers to support more connections.

vi /etc/postgresql/8.x/main/pg_hba.conf
# local      DATABASE  USER  METHOD  [OPTION]
# host       DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
host all all 0.0.0.0/0 md5

#su postgres
>psql
>CREATE ROLE username CREATEDB LOGIN PASSWORD '123456';

view:
> SELECT * FROM pg_user;
> SELECT * FROM pg_roles;
    




Comments