Lesson-41 PostgreSQL新手入门

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

    原文作者:阿瑟李
    原文地址: https://www.jianshu.com/p/26b9b9e26ace
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞