日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Linux下安裝PostgreSQL

在linux下安裝PostgreSQL有二進(jìn)制格式安裝和源碼安裝兩種安裝方式,這里用的是二進(jìn)制格式安裝。各個(gè)版本的Linux都內(nèi)置了PostgreSQL,所以可直接通過命令行安裝便可。本文用的是CentOS 6.5。

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比新昌網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式新昌網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋新昌地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。

安裝Postgresql

--------------------------------------------------------------------------------

# 安裝postgresql服務(wù)器
yum install postgresql-server
#依賴包是否安裝
Y/N  Y

#第三方貢獻(xiàn)包
yum install postgresql-contrib
#依賴包是否安裝
Y/N  Y

安裝成功后,數(shù)據(jù)庫狀態(tài)

[root@localhost Hadoop]# service postgresql status
postmaster is stopped

嘗試啟動(dòng)數(shù)據(jù)庫,但報(bào)錯(cuò),需要先初始化數(shù)據(jù)目錄

[root@localhost hadoop]# service postgresql start
/var/lib/pgsql/data is missing.Use "service postgresql initdb" to initialize the cluster first.
[root@localhost hadoop]# service postgresql initdb
Initializing database:                                                [OK]

啟動(dòng)數(shù)據(jù)庫

--------------------------------------------------------------------------------

通過service命令啟動(dòng)Postgresql,需要注意的是,默認(rèn)在安裝時(shí)會(huì)創(chuàng)建postgres用戶并安裝到此用戶下。而Postgresql 的默認(rèn)數(shù)據(jù)庫也是用此用戶命名的。

[root@localhost hadoop]# service postgresql start
Starting postgresql service:                              [  OK  ]
[root@localhost hadoop]# su - postgres
-bash-4.1$ psql
psql (8.4.20)
Type "help" for help.

postgres=# \l
                                  List of databases
  Name    |  Owner  | Encoding |  Collation  |    Ctype    |  Access privileges 
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8    | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8    | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                            : postgres=CTc/postgres
 template1 | postgres | UTF8    | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                            : postgres=CTc/postgres
(3 rows)

postgres=#

Postgresql 的Psql 就等于Oracle的Sqlplus一樣 ,直接用命令Psql登錄等于用操作系統(tǒng)驗(yàn)證登錄,不需要輸入用戶名和密碼。

基本參數(shù)設(shè)置

--------------------------------------------------------------------------------

在Centos下,默認(rèn)的數(shù)據(jù)目錄在 /var/lib/pgsql/data 下 ,配置的參數(shù)文件就在此目錄下。

-bash-4.1$ ls -l
total 80
drwx------ 5 postgres postgres  4096 Nov 16 07:43 base
drwx------ 2 postgres postgres  4096 Nov 17 23:51 global
drwx------ 2 postgres postgres  4096 Nov 16 07:43 pg_clog
-rw------- 1 postgres postgres  3533 Nov 17 22:05 pg_hba.conf
-rw------- 1 postgres postgres  1631 Nov 16 07:43 pg_ident.conf
drwx------ 2 postgres postgres  4096 Nov 18 00:00 pg_log
drwx------ 4 postgres postgres  4096 Nov 16 07:43 pg_multixact
drwx------ 2 postgres postgres  4096 Nov 18 00:00 pg_stat_tmp
drwx------ 2 postgres postgres  4096 Nov 16 07:43 pg_subtrans
drwx------ 2 postgres postgres  4096 Nov 16 07:43 pg_tblspc
drwx------ 2 postgres postgres  4096 Nov 16 07:43 pg_twophase
-rw------- 1 postgres postgres    4 Nov 16 07:43 PG_VERSION
drwx------ 3 postgres postgres  4096 Nov 16 07:43 pg_xlog
-rw------- 1 postgres postgres 16877 Nov 17 21:54 postgresql.conf
-rw------- 1 postgres postgres    57 Nov 17 23:51 postmaster.opts
-rw------- 1 postgres postgres    45 Nov 17 23:51 postmaster.pid

配置遠(yuǎn)程登錄數(shù)據(jù)庫

1. 修改 postgresql.conf 文件,配置PostgreSQL數(shù)據(jù)庫服務(wù)器的相應(yīng)的參數(shù)

listen_addresses = '*'      # PostgreSQL安裝完成后,默認(rèn)是只接受來在本機(jī)localhost的連接請求,此處將數(shù)據(jù)庫服務(wù)器的監(jiān)聽模式修改為監(jiān)聽所有主機(jī)發(fā)出的連接請求
port = 5432      #  默認(rèn)端口,修改后要重啟數(shù)據(jù)庫

2. 修改 pg_hba.conf 文件,配置對數(shù)據(jù)庫的訪問權(quán)限

在最后一行加上配置,表示允許網(wǎng)段192.168.191.0上的所有主機(jī)使用所有合法的數(shù)據(jù)庫用戶名訪問數(shù)據(jù)庫,

24是子網(wǎng)掩碼,表示允許IP范圍在 192.168.191.0--192.168.191.255 的計(jì)算機(jī)訪問。

3. 測試遠(yuǎn)程登錄

首先修改默認(rèn)數(shù)據(jù)庫用戶登錄密碼

-bash-4.1$ psql
psql (8.4.20)
Type "help" for help.

postgres=# \password

按提示修改密碼。

然后再從另一臺(tái)局域網(wǎng)機(jī)器上登錄

psql -U postgres -d postgres -h 192.168.191.5 -p 5432      -- 成功

其中 –u 指定用戶,-d 指定數(shù)據(jù)庫名 ,-h 指定host,-p 端口號,按提示輸入密碼。

另外,可視化客戶端推薦用DBeaver。


新聞名稱:Linux下安裝PostgreSQL
文章源于:http://m.5511xx.com/article/cooohgd.html