Skip to content

Instantly share code, notes, and snippets.

@sandyxu
Created August 23, 2013 09:57
Show Gist options
  • Save sandyxu/6317581 to your computer and use it in GitHub Desktop.
Save sandyxu/6317581 to your computer and use it in GitHub Desktop.
PostgreSql install & init & star
$brew doctor
$brew install postgreSql
#初始化数据库
$ initdb /usr/local/var/postgres -E utf8
#Success. You can now start the database server using:
# postgres -D /usr/local/var/postgres
#or
# pg_ctl -D /usr/local/var/postgres -l logfile start
#设置开机启动psql
To have launchd start postgresql at login:
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
上面是建立软链,也可如下:
$cp /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
手动启动:
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
$ psql --version
psql (PostgreSQL) 9.2.3
$ which psql
/usr/local/bin/psql
OK!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment