Ubuntu - 安裝PostgreSQL

  • 6492
  • 0

摘要:PostgreSQL

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-12-04

 

做維護,還什麼都要碰,

這次碰到了postgreSQL

這啥鬼,不知道,

 

總之我要在Ubuntu安裝postgreSQL

這是一個不錯的文章

實測一遍

 

apt-get update

(但這個又發生我上一篇文章所提的,要修改etc/apt/sources.list,Not Found問題

http://www.dotblogs.com.tw/newmonkey48/archive/2015/04/22/151117.aspx)

 

再來下安裝指令

sudo apt-get install postgresql postgresql-contrib

 

可能安裝完後,會自動有一個使用者角色,postgres

進行切換

sudo su - postgres

 

然後在這個使用者下,你可以建立使用者createuser (話說,好像叫角色Role)

 

總之還有一堆不熟的。

然後可以建立database

createdb events

 

再用psql -d events 指令,登入postgresql

就出現了

events=#

指後就開始打指令 

如果要跳出

請使用

\q

 

修改使用者密碼及安裝postgresql參考連結

http://cat-son.blogspot.tw/2012/11/ubuntupostgresql.html#sthash.wu2lDadz.dpbs

 

進入postgreSQL command

psql

修改密碼

ALTER USER username WITH PASSWORD 'password';