Install PostgreSQL and centos7postgresql on CentOS7

Source: Internet
Author: User
Tags psql

Install PostgreSQL and centos7postgresql on CentOS7

  • Install the postgresql Software Package
sudo yum install postgresql-server postgresql
  • Initialize db
sudo su - postgresinitdb -D /var/lib/pgsql/data
  • Start/stop a service
systemctl status postgresql.servicesystemctl start postgresql.servicesystemctl stop postgresql.service
  • Modify the configuration to allow remote access

Modify the/var/lib/pgsql/data/postgresql. conf file

listen_addresses ='*'

Modify the/var/lib/pgsql/data/pg_cmd.conf file **

host    all             all             0.0.0.0/0            trust
  • After modification, restart the service.
systemctl restart postgresql.service
  • Create users and databases
$ sudo su - postgres$ psql -U postgres -W$ Password for user postgres: postgrespostgres=# CREATE USER <user> WITH PASSWORD '<password>';postgres=# CREATE DATABASE test OWNER <user> ENCODING 'UTF8';
  • Test
$ psql -U kongxx -d testtest=> \dt

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.