Postgresql Basic Operation on Mac OSX

2016-04-19 by Adler Hsieh


Installation

brew install postgres

Initiation

initdb /usr/local/var/postgres

Create User

createuser --pwprompt my_user

my_user is the username.

Create Database

createdb -Omy_user -Eutf8 my_database
  • my_user is the username, and the owner of the database.
  • my_database is the db name.

Entering DB console

psql -U my_user -W my_database

Done!