Postgres没有创建用户的权限 [英] Postgres No permission to create user
问题描述
我无法在postgres中使用rails。数据库不会创建:
I am unable to use rails with postgres. The database wont create:
sayth@sayth-TravelMate-5740G:~/testapp2$ rake db:create:all
PG::InsufficientPrivilege: ERROR: permission denied to create database
: CREATE DATABASE "testapp2_development" ENCODING = 'unicode'
....
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"testapp2_production", "pool"=>5, "username"=>"testapp2", "password"=>nil}
所以我在这里 https://stackoverflow.com/a/8639649
这些是我遇到的问题。
$ psql -d postgres
postgres=# create role app_name login createdb;
postgres=# \q
但是当我在psql shell中给出
However when I am in the psql shell to give the create role with createdb ability it fails auth.
sayth@sayth-TravelMate-5740G:~/testapp2$ psql -d postgres
psql (9.2.4)
Type "help" for help.
postgres=> create role sayth createdb;
ERROR: permission denied to create role
postgres=>
然后如何创建身份验证?
How then do I create the auth?
编辑更新
审核 http://www.postgresql .org / docs / 9.2 / static / tutorial-createdb.html
和 http://www.postgresql.org/docs/9.2/static/database-roles.html
但不能使用root,因为它不存在,所以我需要创建它。
But cannot use root to create accounts as it doesn't exist and I need to be root to create it.
sayth@sayth-TravelMate-5740G:~$ sudo psql -d postgres
[sudo] password for sayth:
Sorry, try again.
[sudo] password for sayth:
psql: FATAL: role "root" does not exist
推荐答案
您使用的用户名/密码缺少创建用户和数据库所需的管理员权限。
The username / password you use lack the administrator rights that are necessary for creation users and databases.
以管理员身份登录并修复权限。如果您具有管理员登录凭据,请登录并使用 ALTER ROLE 来修复该帐户的权利。
Login as administrator and fix the permissions. If you have administrator login credentials, login and use ALTER ROLE to fix the rights on that account.
这篇关于Postgres没有创建用户的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!