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