How to create a user, a database and grant all privileges on the new database?
sudo -u postgres psql
postgres=# CREATE DATABASE mydb;
postgres=# CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypass';
postgres=# GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
postgres=# GRANT ALL ON SCHEMA public TO myuser;
Further Reading on: