MAC 安裝 postgresql
brew install postgresql
創建postgreSql數據庫:
initdb /usr/local/var/postgres
啟動服務:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
停止服務:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
自動啟動服務:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.2.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
刪除自動啟動服務:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist