Mac下經過brew安裝postgresql

Mac下安裝 postgrep。使用brew包管理工具能夠方便的安裝git

brew 就是 Homebrew 安裝方法github

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Mac OS X已經自帶Rubysql

安裝完 brew後。用brew安裝Postgresqlshell

brew install postgrepsql

安裝完畢看到postgresql軟件被安裝到 /usr/local/Cellar/postgrepsql/9.4.3/  而且創建了一個連接目錄 /usr/local/opt/postgresql數據庫

安裝最後自動初始化了一個數據庫路徑爲 /usr/local/val/postgresruby

啓動Postgresqlcurl

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

中止Postgresql工具

pg_ctl -D /usr/local/var/postgres stop -s -m fast

新建一個數據庫用戶post

createuser weixinadmin -P

爲這個用戶新建一個數據庫url

createdb weixindb -O weixinadmin -E UTF8 -e

用這個用戶訪問數據庫

psql -U weixinadmin -d weixindb -h 127.0.0.1
相關文章
相關標籤/搜索