Skip to content

Instantly share code, notes, and snippets.

@Krettis
Last active November 13, 2015 10:29
Show Gist options
  • Save Krettis/e57ac51895912564227f to your computer and use it in GitHub Desktop.
Save Krettis/e57ac51895912564227f to your computer and use it in GitHub Desktop.
psql terminal stuff

List

\list or \l: list all databases

select database

\connect dbname or \c dbname

import

psql dbname < filepath

template1=# CREATE USER tom WITH PASSWORD 'myPassword'; Step #5: Add a database called jerry

Type the following command (you need to type command highlighted with red color): template1=# CREATE DATABASE jerry;

Now grant all privileges on database template1=# GRANT ALL PRIVILEGES ON DATABASE jerry to tom;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment