PostgreSQL allows remote access settings

Source: Internet
Author: User
Tags unix domain socket postgresql backup

After the PostgreSQL database is installed, only local access connections are accepted by default. If you want to access the PostgreSQL database server on another host, you need to configure it accordingly.

To configure a remote connection to a PostgreSQL database, you only need to modify pg_hba.conf and postgresql. conf under the data Directory.

Pg_cmd.conf: Configure database access permissions,

Postgresql. conf: configure the corresponding parameters of the PostgreSQL database server.

The following describes the configuration steps:

1. Modify the pg_cmd.conf file and configure the user's access permissions (# The line starting with the comment content ):

  1. # Type database user CIDR-ADDRESS METHOD
  2. # "Local" is for Unix domain socket connections only
  3. Local all trust
  4. # IPv4 local connections:
  5. Host all 127.0.0.1/32 trust
  6. Host all 192.168.1.0/24 md5
  7. # IPv6 local connections:
  8. Host all: 1/128 trust

The first entry is newly added. It indicates that all hosts on the network segment 192.168.1.0 are allowed to access the database using all valid database usernames and provide encrypted password verification.

Here, the number 24 is a subnet mask, which allows access to computers from 192.168.1.0 -- 192.168.1.255!

 

2. Modify the postgresql. conf file to change the listening mode of the database server to listening for connection requests from all hosts.

Go to # listen_addresses = 'localhost '. After PostgreSQL is installed, it only accepts the local localhost connection by default.

Remove the beginning of the line # and change the line content to listen_addresses = '*' to allow the database server to listen for connection requests from any host.

PostgreSQL deletes duplicate data rows in a table

Establishment of PostgreSQL database connection pool PgBouncer

Compiling PostgreSQL on Windows

Notes on PostgreSQL backup

PostgreSQL details: click here
PostgreSQL: click here

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.