- Create a copy of a database
$ createdb -O <owner> -T database_to_copy new_database
- Create a database
$ createdb -O <owner> database_name
- Grant privileges to user on database
$ psql <db_name> -U <user>
# GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <user>;
- Delete a database
dropdb <dbname>
- Load database from a backup. Just like the linux pipe
psql <dbname> < infile
- Create a backup of the database.
pg_dump <dbname> > outfile
https://www.codementor.io/engineerapart/getting-started-with-postgresql-on-mac-osx-are8jcopb