PostgreSQL Learning Notes (iv) roles

Source: Internet
Author: User
Tags postgresql

1. During the data initialization phase during PostgreSQL installation, a role named Postgres is created by default (and a database named Postgres is created).

2. The ident authentication mechanism can be used to map the root user of the operating system to the PostgreSQL role of the data, so that the root user can log in without a password directly

3. Create a role with login privileges

postgres=# Create role Leo login password ' king ' createdb valid until ' infinity ';

The valid line is optional, and its function is to set the validity period for this role, all permissions expire after expiration, and the default time limit is infinity, which never expires.

The Createdb modifier indicates that permissions to create a database are given to this role

4. Create a role with superuser privileges

postgres=# Create role Regina login password ' Queen ' superuser valid until ' 2019-1-1 00:00 ';

5. Create a group role

postgres=# Create role Royalty INHERIT;

Inherit indicates that any of the member roles of group role royalty will automatically inherit all of its permissions except Superuser rights.

To grant the permissions of a group role to its member role

postgres=# Grant royalty to leo;postgres=# Grant royalty to Regina;


This article is from the "Corasql" blog, make sure to keep this source http://corasql.blog.51cto.com/5908329/1914386

PostgreSQL Learning Notes (iv) roles

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.