构建PostgreSQL工作环境
发布时间:2020-12-13 17:30:35 所属栏目:百科 来源:网络整理
导读:构建PostgreSQL工作环境 jieshiyeskey@gmail.com 1.创建用户并附权限及设置密码 postgres=# create role markgeng password 'Jieshi11gR2' login superuser createdb createrole; CREATE ROLE postgres=# dg+ List of roles Role name | Attributes | Member
构建PostgreSQL工作环境
jieshiyeskey@gmail.com
1.创建用户并附权限及设置密码
postgres=# create role markgeng password 'Jieshi11gR2' login superuser createdb createrole;
CREATE ROLE
postgres=# dg+
-----------+------------------------------------------------+-----------+-------------
2.创建表空间
postgres=# create tablespace tsp_users owner markgeng location '/Library/PostgreSQL/9.2/data/tsp_users';
postgres=# db+
------------+----------+----------------------------------------+-------------------+-------------
3.创建数据库
postgres=# create database orcl owner=markgeng tablespace=tsp_users;
CREATE DATABASE
postgres=# l+
---------------+----------+----------+---------+-------+-----------------------+---------+------------+--------------------------------------------
4.创建schema
postgres=# c orcl markgeng
Password for user markgeng:
You are now connected to database "orcl" as user "markgeng".
orcl=# create schema authorization markgeng;
CREATE SCHEMA
orcl=# dn+
----------+----------+----------------------+------------------------
(2 rows)
5.创建表
orcl=# create table t1(id int);
CREATE TABLE
orcl=# dt+
----------+------+-------+----------+---------+-------------
(1 row)
orcl=# d t1
--------+---------+-----------
orcl=# insert into t1 values(1);
INSERT 0 1
orcl=# select * from t1;
----
(1 row)
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |