构建PostgreSQL工作环境

构建PostgreSQL工作环境,第1张

概述构建PostgreSQL工作环境 [email protected] 1.创建用户并附权限及设置密码 postgres=# create role markgeng password 'Jieshi11gR2' login superuser createdb createrole; CREATE ROLE postgres=# \dg+                         构建Postgresql工作环境 [email protected]
1.创建用户并附权限及设置密码 postgres=# create role markgeng password 'JIEshi11gR2' login superuser createdb createrole; CREATE RolE
postgres=# \dg+ List of roles Role name | Attributes | Member of | Description -----------+------------------------------------------------+-----------+------------- markgeng | Superuser,Create role,Create DB | {} | postgres | Superuser,Create DB,Replication | {} |
2.创建表空间 postgres=# create tablespace tsp_users owner markgeng location '/library/Postgresql/9.2/data/tsp_users'; postgres=# \db+ List of tablespaces name | Owner| Location | Access privileges | Description ------------+----------+----------------------------------------+-------------------+------------- pg_default | postgres | | | pg_global | postgres | | | tsp_users | markgeng | /library/Postgresql/9.2/data/tsp_users | | 3.创建数据库 postgres=# create database orcl owner=markgeng tablespace=tsp_users; CREATE DATABASE postgres=# \l+ List of databases name | Owner | EnCoding | Collate | Ctype | Access privileges | Size | tablespace | Description ---------------+----------+----------+---------+-------+-----------------------+---------+------------+-------------------------------------------- home_markgeng | postgres | UTF8 | C | C | | 6233 kB | pg_default | orcl | markgeng | UTF8 | C | C | | 6293 kB | tsp_users| postgres | postgres | UTF8| C | C | | 6797 kB | pg_default | default administrative connection database template0 | postgres | UTF8| C | C | =c/postgres +| 6177 kB | pg_default | unmodifiable empty database | | | | | postgres=CTc/postgres | | | template1 | postgres | UTF8| C | C | =c/postgres +| 6185 kB | pg_default | default template for new databases | | | | | postgres=CTc/postgres | 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+ List of schemas name | Owner | Access privileges | Description ----------+----------+----------------------+------------------------ markgeng | markgeng | | public | postgres | postgres=UC/postgres+| standard public schema | | =UC/postgres | (2 rows) 5.创建表 orcl=# create table t1(ID int); CREATE table orcl=# \dt+ List of relations Schema | name | Type |Owner| Size | Description ----------+------+-------+----------+---------+------------- markgeng | t1 | table | markgeng | 0 bytes | (1 row) orcl=# \d t1 table "markgeng.t1" Column | Type | ModifIErs --------+---------+----------- ID | integer |

orcl=# insert into t1 values(1); INSERT 0 1 orcl=# select * from t1; ID ---- 1 (1 row) 总结

以上是内存溢出为你收集整理的构建PostgreSQL工作环境全部内容,希望文章能够帮你解决构建PostgreSQL工作环境所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1177245.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存