close

1. 為什麼要用postgresql?

http://sitig.blog.ithome.com.tw/post/3842/137072

2. 搞了一會兒,終於弄懂他的邏輯

sudo apt-get install postgresql (用套件安裝)
照理來說 套件安裝後 會自動在linux建立一個新帳號 "postgres"
密碼預設應該是空白的 如果真的登入不進去 就先繞去root吧
sudo -i
su - postgres
為了日後方便 還是給此帳號自己的密碼吧!

再來我就傻傻的建立資料庫
createdb test_db
就得到

dropdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

這樣的error訊息
其實他代表server還沒有跑起來!!

請這樣做
mkdir data (你要放資料庫的地方)
cd data
/usr/lib/postgresql/8.4/bin/initdb ./

然後他會印出兩種方法start db server
Success. You can now start the database server using:

/usr/lib/postgresql/8.4/bin/postgres -D .
or
/usr/lib/postgresql/8.4/bin/pg_ctl -D . -l logfile start

server run起來後
createdb 就可以用了

其他教學:
http://twpug.net/docs/postgresql-doc-8.0-zh_TW/tutorial-createdb.html

再來研究囉~


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jpsix 的頭像
    jpsix

    地瓜粥在讀書

    jpsix 發表在 痞客邦 留言(0) 人氣()