PostgreSQL Installation and Use

Source: Internet
Author: User
Tags psql

Install

1. Yum install PostgreSQL postgresql-Server

2. initialize the database and start the service

Service PostgreSQL initdb

Service PostgreSQL start

3. When PostgreSQL port 5432 has a firewall, it must be enabled.

Configuration

The installation path of Yum after PostgreSQL is/var/lib/pgsql. The main configuration file is in its data folder and enters the data folder.

1. Modify the PostgreSQL. conf file

If you want PostgreSQL to listen to the entire network, remove the # Before listen_addresses and change listen_addresses = 'localhost' to listen_addresses = '*'

2. Modify pg_cmd.conf.

This file has a list at the end, which determines the permissions assigned to each user and the authentication method. The format is "type Database User address method". Note that it is best to write MD5 to method.

Append a line after the list: Host All all 192.168.1.0/24 Password

3. Modify Postgres User Password: passwd Postgres

4. Change the local Authentication Mode in pg_hba.conf to "trust", and change the current user to "Postgres: su Postgres ".

5. Use Psql to log on to the PostgreSQL system and "select * From pg_shadow;". We found that the Postgres user in this table does not have a storage password. Therefore, then, "alter User Login s password 'its password ';

6. Restart the service/etc/init. d/PostgreSQL restart. The connection is successful.

 

Remote connection to Psql-h ip-P 5432-D luoyun-u Postgres

 

 

Problem

Psql. Bin: Fatal: password authentication failed for user "s"

I have added the Postgres user, and the password is too simple to remember correctly. How can I not even connect to it?

 

Check the Internet. Some people say they modify pg_mirror.conf and change the MD5 of the local line to trust. A try.

 

Later, the same problem occurred when the client was remotely logged on. As a result, the MD5 was changed to trust, and the login was successful,

 

As long as you obtain the trust of the other party, the problem is really not a problem.

 

 

Reference

Http://zxggmail.iteye.com/blog/1481278

Http://www.2cto.com/database/201204/126854.html

Http://www.postgresql.org/docs/8.1/interactive/client-authentication.html

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.