Creating a user and database in PostgreSQL

To create a database and user account for use on PostgreSQL:

root@devotion:~# su - postgres

postgres@devotion:~$ psql
psql (8.4.21)
Type "help" for help.

postgres=# create user "www-data" superuser;
CREATE ROLE

postgres=# create database mydb with owner "www-data";
CREATE DATABASE

postgres=# \c mydb
psql (8.4.21)
You are now connected to database "mydb".
                                            ^
mydb=# alter user "www-data" with password 'secret';
ALTER ROLE