Monday, January 9, 2012

New PostgreSQL Databases And The Users That Own Them

A quick post on how to create new databases with owners other than 'postgres'.

$ psql postgres
postgres=# CREATE USER someuser WITH PASSWORD 'password goes here';
CREATE USER
postgres=# CREATE DATABASE newDatabase WITH OWNER = someuser;
CREATE DATABASE

A quick, random password can be created using /dev/random:

$ head -c 10 /dev/random | uuencode -m -