Skip to content

Instantly share code, notes, and snippets.

@mangreen
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mangreen/76f027fa0360beb051be to your computer and use it in GitHub Desktop.
Save mangreen/76f027fa0360beb051be to your computer and use it in GitHub Desktop.

http://jangmt.com/wiki/index.php/PostgreSQL_install

http://blog.jangmt.com/2014/07/linux-mintor-ubuntu-postgresql-93.html

http://www.twbsd.org/cht/book/ch19.htm

安裝 postgresql 9.3 伺服器程式

mt ~ # apt-get install postgresql-9.3

安裝 pgadmin3 的客戶端管理工具

mt ~ # apt-get install pgadmin3

切換到 postgres 帳號, postgres 預設沒有密碼且是 superuser 權限

mt ~ # su - postgres
postgres@mt ~ $ ls
9.3
postgres@mt ~ $ pwd
/var/lib/postgresql

建立使用者帳號,-r 能夠建立 role ,並且賦予 -s 超級使用者、-d 能夠建立 DB 、-l 能夠登入系統、-P能夠建立密碼

postgres@mt ~ $ createuser --r mtchang -s -d -l  -P
Enter password for new role:
Enter it again: 

建立一個資料庫 mtchang 屬於 -O mtchang 使用者的

postgres@mt ~ $ createdb  -O mtchang mtchang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment