加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql安装

发布时间:2020-12-13 18:18:56 所属栏目:百科 来源:网络整理
导读:# yum install readline-devel 未安装readline-devel会出现readline library not found错误 # wget http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.bz2 # tar jxvf postgresql-9.1.2.tar.bz2 -C ../software/ # ./configure --prefix=/h
  1. # yum install readline-devel 未安装readline-devel会出现readline library not found错误 # wget http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.bz2 # tar jxvf postgresql-9.1.2.tar.bz2 -C ../software/ # ./configure --prefix=/home/xuhh/pgsql912 --with-perl --with-python # gmake # gmake install # mkdir /home/xuhh/pgsql912/data # adduser postgres # chown -R postgres.postgres /home/xuhh/pgsql912 # chown postgres.postgres /home/xuhh/pgsql912/data # su - postgres $ /home/xuhh/pgsql912/bin/initdb -D /home/xuhh/pgsql912/data //初始化数据 $ /home/xuhh/pgsql912/bin/postgres -D /home/xuhh/pgsql912/data > /tmp/pg-logfile 2>&1 & //启动数据库
  2. $ /home/xuhh/pgsql912/bin/createdb test //创建数据库 $ /home/xuhh/pgsql912/bin/psql -d test //连接数据库 test=# CREATE TABLE test (id serial,name varchar(32)); test=# insert into test values(1,'abc'); test=# insert into test values('2','bbb'); test=# dp+ //查看表空间 Access privileges Schema | Name | Type | Access privileges | Column access privileges --------+-------------+----------+-------------------+-------------------------- public | test | table | | public | test_id_seq | sequence | | (2 rows) test=# dt+ //查看表 List of relations Schema | Name | Type | Owner | Size | Description --------+------+-------+----------+------------+------------- public | test | table | postgres | 8192 bytes | (1 row)
  3. test=# create tablespace xxoo location '/tmp/'; //创建表空间
  4. test=# select * from pg_tablespace; //查看表空间 spcname | spcowner | spclocation | spcacl | spcoptions ------------+----------+-------------+--------+------------ pg_default | 10 | | | pg_global | 10 | | | xxoo | 10 | /tmp/xxoo | | (3 rows)
  5. test=# alter tablespace xxoo rename to ttlsa; //更改表空间名 ALTER TABLESPACE test=# select * from pg_tablespace; spcname | spcowner | spclocation | spcacl | spcoptions ------------+----------+-------------+--------+------------ pg_default | 10 | | | pg_global | 10 | | | ttlsa | 10 | /tmp/xxoo | | (3 rows)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读