PostgreSQL Database Basics

Source: Internet
Author: User
Tags postgresql

Create a read-only account

1.1 Log in with an initial account

[Email protected] ~]# psql-u Postgres

1.2 Creating a user

postgres=# Create role develop with login password ' 123456 ';

CREATE ROLE

postgres=# select Usename from Pg_user;

Usename

----------

Postgres

Test

Develop

(3 rows)


1.3 Switching databases

\c current_product

1.4 Granting read-only permissions

current_product=# Grant Select on all tables in the schema public to develop;

GRANT

1.5 Switch to develop user

current_product=# \c-develop

Connected to Database "Current_product" as user "develop".

1.6 Detecting whether read-only permission is granted

Current_product=> select * from test;

Id

----

(0 rows)



This article is from the "Youth Deng Yong" blog, please be sure to keep this source http://dengyong.blog.51cto.com/8409869/1888850

PostgreSQL Database Basics

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.