欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

如何進(jìn)行postgre安裝

如何進(jìn)行postgre安裝,很多新手對此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

創(chuàng)新互聯(lián)建站從2013年創(chuàng)立,先為荔城等服務(wù)建站,荔城等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為荔城企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

1        實(shí)驗(yàn)?zāi)康?/h2>

PostgreSQL數(shù)據(jù)庫安裝、初始化及可用性測試。

2        環(huán)境介紹

操作系統(tǒng): RedHat 6.5

數(shù)據(jù)庫軟件:PostgreSQL version9.5

3        PostgreSQL數(shù)據(jù)庫介紹

PostgresQL是以加州大學(xué)伯克利分校計(jì)算機(jī)系開發(fā)的POSTGRES,現(xiàn)在已經(jīng)更名為PostgreSQL,版本4.2為基礎(chǔ)的對象關(guān)系型數(shù)據(jù)庫管理系統(tǒng)(ORDBMS)。PostgreSQL支持大部分SQL標(biāo)準(zhǔn)并且提供了許多其他現(xiàn)代特性:復(fù)雜查詢、外鍵、觸發(fā)器、視圖、事務(wù)完整性、MVCC。同樣,PostgreSQL可以用許多方法擴(kuò)展,比如, 通過增加新的數(shù)據(jù)類型、函數(shù)、操作符、聚集函數(shù)、索引。免費(fèi)使用、修改、和分發(fā)PostgreSQL,不管是私用、商用、還是學(xué)術(shù)研究使用。

4        軟件獲取

官方下載地址:https://yum.postgresql.org/rpmchart.php 

官方文檔:https://www.postgresql.org/docs/

注:建議大家學(xué)習(xí)任何軟件,從閱讀官方文檔開始。

5        安裝方式

方法一:yum安裝

These distributions all include PostgreSQL by default. To install PostgreSQL from these repositories, use the yum command on RHEL 5,6 and 7, or dnf command on Fedora 22+:

yum install postgresql-server

dnf install postgresql-server

Which version of PostgreSQL you get will depend on the version of the distribution:

Distribution

Version

RHEL/CentOS/SL/OL 7

9.2(also supplies package  rh-postgresql95 and rh-postgresql94 via SCL)

RHEL/CentOS/SL/OL 6

8.4(also supplies package  postgresql92)

RHEL/CentOS/SL/OL 5

8.1 (also supplies package  postgresql84)

Fedora 24

9.5

Fedora 23

9.4

方法二:直接下載RPM 安裝

方法三:源碼包安裝

6        安裝實(shí)踐

6.1      檢查PostgreSQL 是否已經(jīng)安裝

[root@mhapp1 ~]# rpm -qa|grep postgres

postgresql-8.4.18-1.el6_4.x86_64

postgresql-libs-8.4.18-1.el6_4.x86_64

postgresql-devel-8.4.18-1.el6_4.x86_64

若已安裝使用rpm –e卸載。注:請確認(rèn)是練習(xí)庫?。?!

6.2安裝PostgreSQL,注意安裝順序

[root@mhapp1 rpm]# rpm -ivh postgresql95-libs-9.5.6-2PGDG.rhel6.x86_64.rpm

warning: postgresql95-libs-9.5.6-2PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY

Preparing...                ########################################### [100%]

   1:postgresql95-libs      ########################################### [100%]

[root@mhapp1 rpm]# rpm -ivh postgresql95-9.5.6-2PGDG.rhel6.x86_64.rpm

warning: postgresql95-9.5.6-2PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY

Preparing...                ########################################### [100%]

   1:postgresql95           ########################################### [100%]

[root@mhapp1 rpm]# rpm -ivh postgresql95-server-9.5.6-2PGDG.rhel6.x86_64.rpm

warning: postgresql95-server-9.5.6-2PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY

Preparing...                ########################################### [100%]

   1:postgresql95-server    ########################################### [100%]

[root@mhapp1 rpm]# rpm -ivh postgresql95-contrib-9.5.6-2PGDG.rhel6.x86_64.rpm

warning: postgresql95-contrib-9.5.6-2PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY

Preparing...                ########################################### [100%]

   1:postgresql95-contrib   ########################################### [100%]

6.3初始化PostgreSQL

[root@mhapp1 rpm]# /etc/init.d/postgresql-9.5 start

/var/lib/pgsql/9.5/data is missing. Use "service postgresql-9.5 initdb" to initialize the cluster first.

[root@mhapp1 rpm]# service postgresql-9.5 initdb

Initializing database: [  OK  ]

6.4啟動(dòng)服務(wù)

[root@mhapp1 rpm]# service postgresql-9.5 start

Starting postgresql-9.5 service: [  OK  ]

6.5把PostgreSQL 服務(wù)加入到啟動(dòng)列表

[root@mhapp1 rpm]# chkconfig postgresql-9.5 on

[root@mhapp1 rpm]# chkconfig --list|grep postgres

postgresql-9.5         0:off 1:off 2:on 3:on 4:on 5:on 6:off

6.6修改PostgreSQL數(shù)據(jù)庫用戶postgres的密碼

PostgreSQL數(shù)據(jù)庫默認(rèn)會(huì)創(chuàng)建一個(gè)postgres的數(shù)據(jù)庫用戶作為數(shù)據(jù)庫的管理員,默認(rèn)密碼為空,我們需要修改為指定的密碼

[root@mhapp1 rpm]# su - postgres

$ id

uid=26(postgres) gid=26(postgres) groups=26(postgres)

$ psql

psql (9.5.6)

Type "help" for help.

postgres=# alter user postgres with password'orastar';

ALTER ROLE

postgres=# select * from pg_shadow;

 usename  | usesysid | usecreatedb | usesuper | userepl | usebypassrls |               passwd                | valuntil | useconfig

----------+----------+-------------+----------+---------+--------------+-------------------------------------+----------+----------

-

 postgres |       10 | t           | t        | t       | t            | md53175bce1d3201d16594cebf9d7eb3f9d |          |

(1 row)

7        測試數(shù)據(jù)庫

7.1創(chuàng)建測試數(shù)據(jù)庫

postgres=#

postgres=# create database htdb;

CREATE DATABASE

7.2切換到htdb數(shù)據(jù)庫

postgres=# \c htdb

You are now connected to database "htdb" as user "postgres".

7.3創(chuàng)建測試表

htdb=# create table test(id integer,name text);

CREATE TABLE

7.4插入測試數(shù)據(jù)

htdb=# insert into test values(1,'ht');

INSERT 0 1

7.5查詢數(shù)據(jù)

htdb=# select * from test;

 id | name

----+------

  1 | ht

(1 row)

htdb=#

看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。

文章名稱:如何進(jìn)行postgre安裝
文章轉(zhuǎn)載:http://chinadenli.net/article22/jiiijc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、App開發(fā)、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站策劃、網(wǎng)站制作、網(wǎng)站維護(hù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)