CentOS 7 64-bit installation PostgreSQL 9.2 finishing

Source: Internet
Author: User
Tags access database

CentOS version

LSB Version:: Core-4.1-amd64:core-4.1-noarch
Distributor Id:centos
Description:centos Linux release 7.0.1406 (Core)
release:7.0.1406
Codename:core

Note: CentOS installs PostgreSQL with Yum

The database program path is:/usr/pgsql-9.2

The database storage file path is:/var/lib/pgsql/

1. run:yum install Postgresql92-server Postgresql92-contrib

2. View: rpm-qa|grep PostgreSQL

3. initialization:/usr/pgsql-9.2/bin/postgresql92-setup initdb

4. enable:systemctl enable Postgresql-9.2.service (back to CD/ directory execution)

5. start:systemctl start Postgresql-9.2.service (start/restart/stop)

6. Login: su-postgres

PostgreSQL Database By default creates a postgres database user as the administrator of the database, the default password is empty, we need to change to the specified password, which is set to ' Postgres ' .

    1. Input: Psql
    2. Change Password:

# ALTER USER postgres with PASSWORD ' postgres ';

    1. Create a database

# CREATE DATABASE David;

    1. Switch database

# \c David

11. Modify the postgressql Database configuration for remote access

Modify the postgresql.conf file

# vi/var/lib/pgsql/9.2/data/postgresql.conf

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

12. Modify the Client Authentication profile pg_hba.conf

Add the IP address or address segment of the remote Access database to the file.

# vi/var/lib/pgsql/9.2/data/pg_hba.conf

Allow all host all 0.0.0.0/0 MD5

Restart the service for the settings to take effect

Create a User:

Create User Dbadmin

View System Users

SELECT * from Pg_shadow;

Exit

\q

CentOS 7 64-bit installation PostgreSQL 9.2 grooming

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.