Configure PostgreSQL Remote Access

Source: Internet
Author: User
Tags unix domain socket

Original article: http://www.cnblogs.com/xinyaping/archive/2011/04/15/2089081.html

Environment: Ubuntu 12.04 + PostgreSQL 9.1

PostgreSQL is installed by default using the dpkg-I command. The file paths of other installation methods may be different. If you cannot find the configuration file, use find/-name "..." to find it.

1. Edit pg_cmd.conf and configure the user's access permissions.

Vim/etc/PostgreSQL/9.1/main/pg_assist.conf

As follows:

# "Local" is for Unix domain socket connections only
Local all ident
# IPv4 local connections:
Host All all 127.0.0.1/32 MD5
Host All all 172.16.230.0/24 MD5
Host All all 192.168.98.0/24 MD5

The two rows marked in bold are added by me. These two rows allow users of the two network segments to access the database.

2. Edit PostgreSQL. conf to enable the database server to listen to connection requests from all hosts.

VI/etc/PostgreSQL/9.1/main/PostgreSQL. conf

As follows:

Find the line listen_addresses = 'localhost' and change it:

Listen_addresses = '*'

This line is usually commented out. Remove the annotator "#" to make this line take effect.

After restarting the database service, you can use clients such as pgadmin3 to remotely access the database.

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.