pg创建数据库和用户并授权
pg创建数据库和用户并授权postgres=# create database jycdb;CREATE DATABASEpostgres=# create user jyc with password 'jyc';CREATE ROLEpostgres=# revoke connect on database jycdb from public;REVOKEpostgres=# grant al
·
pg创建数据库和用户并授权
postgres=# create database jycdb;
CREATE DATABASE
postgres=# create user jyc with password 'jyc';
CREATE ROLE
postgres=# revoke connect on database jycdb from public;
REVOKE
postgres=# grant all on database jycdb to jyc;
GRANT
postgres=# \c jycdb jyc
Password for user jyc:
You are now connected to database "jycdb" as user "jyc".
jycdb=> \dt
Did not find any relations.
jycdb=> create table test (id int);
CREATE TABLE
jycdb=> insert into test values(1);
INSERT 0 1
jycdb=> select * from test;
id
----
1
(1 row)
jycdb=> \dt
List of relations
Schema | Name | Type | Owner
--------+------+-------+-------
public | test | table | jyc
(1 row)
jycdb=> drop table test;
DROP TABLE
jycdb=> \dt
Did not find any relations.
jycdb=> \l
相关参考:
更多推荐
已为社区贡献11条内容
所有评论(0)