我想创建一个只能访问指定数据库的用户。然而,该用户应具有所有权限。我在Ubuntu 14.04上使用Postgresql 9.5。首先,我创建一个新用户:
接下来,我将使用所有者为Joe创建一个新的数据库:
下一步我该做什么?
$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
接下来,我将使用所有者为Joe创建一个新的数据库:
$sudo -u postgres psql
$CREATE DATABASE myDB OWNER joe;
$GRANT ALL ON DATABASE myDB TO joe;
接下来,我尝试连接用户Joe以连接到我的数据库myDB:
$psql myDB -U joe
psql: FATAL: Peer authentication failed for user "joe"
下一步我该做什么?