Skip to content

postgreSQL tips and commands

John Evans edited this page May 17, 2015 · 1 revision

postgres is very finicky about privileges and users

Good Guide for Basics

Generally I've had the best luck with creating a user on bash:

$ useradd LOGIN-NAME
then you can switch into a new user with the following command:
$ sudo -u user2 zsh

Best is to create the user: postgres and let that super user handle all your postgres needs.

to drop a database: $ dropdb database_name
to create a database: $ createdb database_name
to restore a database from .dump file: $ pg_restore -O -d database_name file_name

Clone this wiki locally