Postgresql User Management

Source: Internet
Author: User
Tags postgresql psql

One, set the super user password

1 Modify pg_hba.conf to enable Superuser Postgres to log in to the database

Host All 127.0.0.1/32 Trust

2 Modify Postgres Password

127.0. 0.1 psql (9.6. 4  "help" for help.postgres=#  'new Password';
ALTER ROLE

3 Modify pg_hba.conf access mode MD5

Host All 127.0.0.1/32 MD5

Common ident default to use with indent.conf

Trust does not require a password

Reject refused

Password Password access plaintext

MD5 Password Access Encryption * *

4 Test Login

127.0. 0.1   for user postgres:psql (9.6.  4"help" for help.postgres=#

Second, new user and authorization

There is no difference between user and role in Postgres, user has one more login access right than role

postgres=# CREATE USER user1; Create Rolepostgres=# CREATE DATABASE db1; CREATE database          Postgres=# GRANT All on the database db1 to User1; GRANT
postgres=# REVOKE all on the DATABASE db1 from User1;
REVOKE

Postgresql User Management

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.