欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ubuntu安裝postgresql和使用方法

  發(fā)布時(shí)間:2014-04-30 14:47:11   作者:佚名   我要評(píng)論
這篇文章主要介紹了ubuntu安裝postgresql和使用方法,需要的朋友可以參考下

安裝組件

客戶端安裝
sudo apt-get install postgresql-client
服務(wù)器安裝

復(fù)制代碼
代碼如下:

sudo apt-get install postgresql postgresql-contrib

獲取Installing PostGIS, procedural languages, client interfaces等插件列表

復(fù)制代碼
代碼如下:

apt-cache search postgres

Ruby PG gem安裝,需要生成Native Extension

首先安裝相應(yīng)package

復(fù)制代碼
代碼如下:

sudo apt-get install libpq-dev

找到pg_config所在位置

復(fù)制代碼
代碼如下:

sudo find / -name pg_config

安裝pg gem

復(fù)制代碼
代碼如下:

gem install pg -- --with-pg-config=/usr/bin/pg_config

服務(wù)器配置
設(shè)置postgres用戶,用postgres用戶登錄并修改密碼

復(fù)制代碼
代碼如下:

sudo -u postgres psql postgres

為postgres用戶設(shè)置密碼

復(fù)制代碼
代碼如下:

\password postgres

創(chuàng)建新數(shù)據(jù)庫(kù)

復(fù)制代碼
代碼如下:

sudo -u postgres createdb mydb

服務(wù)器高級(jí)設(shè)置
創(chuàng)建用戶

復(fù)制代碼
代碼如下:

sudo -u postgres createuser --superuser $USER
sudo -u postgres psql
postgres=# \password $USER

管理用戶及權(quán)限

編輯/etc/postgresql/current/main/postgresql.conf文件用以監(jiān)聽(tīng)其它網(wǎng)絡(luò)

復(fù)制代碼
代碼如下:

listen_addresses = '*'

創(chuàng)建新用戶tesdb及該用戶所擁有的數(shù)據(jù)庫(kù)testdb

復(fù)制代碼
代碼如下:

sudo -u postgres createuser -D -A -P testdb
sudo -u postgres createdb -O testdb testdb

編輯/etc/postgresql/current/main/pg_hba.conf文件,允許testdb用戶遠(yuǎn)程連接testdb數(shù)據(jù)庫(kù)

復(fù)制代碼
代碼如下:

host testdb testdb 0.0.0.0/0 md5

重新加載配置

復(fù)制代碼
代碼如下:

sudo /etc/init.d/postgresql reload

重啟數(shù)據(jù)庫(kù)

復(fù)制代碼
代碼如下:

sudo /etc/init.d/postgresql restart

相關(guān)文章

最新評(píng)論