-
Notifications
You must be signed in to change notification settings - Fork 0
postgres
Following steps are base on assumption that Homebrew is already installed in Mac
brew install postgres
There will be lots of informations shown on your console after you install PostgreSQL. And you can ask homebrew to show it again using this command
brew info postgres
If this is the first install, create a database with:
initdb /usr/local/var/postgres
And open postgres service when launch Os X:
cp /usr/local/Cellar/postgresql/9.0.1/org.postgresql.postgres.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
You could start/stop service with these commands:
Start Service: pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop Service: pg_ctl -D /usr/local/var/postgres stop -s -m fast
Reload Service: pg_ctl reload -D /usr/local/var/postgres/
It is quit useful when you change the conf file and don't want to stop the postgresql
If everything is alright up until now, you should be able to run postgres client application:
psql --verson
And get something like this:
psql (PostgreSQL) 9.0.1
contains support for command-line editing
To be edited
- \d: Describe an object(databases, tables) in postgreSQL
- \q: Quit