I want to create a user who only has access to a specified database. However, it should have all permission. I use Postgresql 9.5 on Ubuntu 14.04. So first of all, I create a new user:
$createuser --interactive joe Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) n Shall the new role be allowed to create more new roles? (y/n) n
Next I create a new database with owner joe:
$sudo -u postgres psql $CREATE DATABASE myDB OWNER joe; $GRANT ALL ON DATABASE myDB TO joe;
After that, I try to connect with user joe to connect on my database myDB:
$psql myDB -U joe psql: FATAL: Peer authentication failed for user "joe"
What i have to do next?