New Postgres database and user for use in Django

Another one I always forget - how to create a new Postgres database and user for a new Django app. This is possible in one step as long as your Postgres configuration allows you to connect as the ‘postgres’ user:

$ createdb -Upostgres name-of-database

Mine does not so I first switch to the ‘postgres’ user and run the following:

$ sudo -i -u postgres

Then use the ‘createdb’ and ‘createuser’ commands:

$ createdb name-of-database
$ createuser -P name-of-user

Then start psql and grant privileges to the user:

$ psql
postgres=# GRANT ALL PRIVILEGES ON DATABASE name-of-database TO name-of-user;

Dan Matthews

Dan Matthews
NIC@King's manager and hobbyist programmer

Installing a Canon LBP7010C printer in Ubuntu 16.04

how to connect and install a canon LBP7010C printer in Ubuntu 16.04 Continue reading

Postgres user

Published on May 16, 2016

Allow postgres user to create database

Published on May 16, 2016