2016-12-13 1 views
0

私はbundle exec rake db:setupを実行しようでサポートされていないのRakeタスクは、それは私にこのエラーバンドルのexecすくいデシベル:セットアップ、「ユーザ名」アダプター

を与え、私は自分のユーザー名にアダプタを変更するとき、私は同じエラーを得た

ここ
PG::InsufficientPrivilege: ERROR: permission denied to create database 
: CREATE DATABASE "freelance_camp_documents_development" ENCODING = 'unicode' 
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"freelance_camp_documents_development"} 
rake aborted! 
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied to create database 
: CREATE DATABASE "freelance_camp_documents_development" ENCODING = 'unicode' 
/usr/local/share/gems/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `async_exec' 
/usr/local/share/gems/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:98:in `block in execute' 
/usr/local/share/gems/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:566:in `block in log' 
/usr/local/share/gems/gems/activesupport- 

私はここに全体のエラーを置くことができない とはdatabase.ymlコード

default: &default 
    adapter: postgresql 
    encoding: unicode 
    # For details on connection pooling, see rails configuration guide 
    # http://guides.rubyonrails.org/configuring.html#database-pooling 
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 

development: 
    <<: *default 
    database: freelance_camp_documents_development 

test: 
    <<: *default 
    database: freelance_camp_documents_test 

production: 
    <<: *default 
    database: freelance_camp_documents_production 
    username: freelance_camp_documents 
    password: <%= ENV['FREELANCE_CAMP_DOCUMENTS_DATABASE_PASSWORD'] %> 
+0

を変更する必要はありませんので、ユーザは、デフォルトで権限を持つのpostgresからユーザーfreelance_camp_documentsための権限を変更することをお勧めまたはちょうどpostgres

production: <<: *default database: freelance_camp_documents_production username: postgres password: <%= ENV['FREELANCE_CAMP_DOCUMENTS_DATABASE_PASSWORD'] %> 

postgresにユーザー名を変更します'開発'モードで動作します。このモードでは、 'database.yml'にユーザ名を指定していません。 – 31piy

+0

@ 31piy私はdatabase.ymlファイルから気づきましたが、devモードをどのように実行するのですか?私は 'bundle exec rake db:setup 'という行を端末で実行してこのエラーが出たので、まだサーバを稼働していません。 – geeksamu

+0

これはサーバーの実行には関係ありません。 'database.yml'ファイルで使用するユーザを指定する必要があります。これにより、DBがそのDBを設定できるようになります。このためにあなたのpostgres設定にアクセスする必要があります。 – 31piy

答えて

0

PG::InsufficientPrivilege: ERROR: permission denied to create database

0であります

ここでの問題は、Postgresのユーザfreelance_camp_documentsに十分な特権がないことです。

私はあなたが私はあなたが願っています何

+0

database.ymlでユーザー名を変更し、同じエラー:\ – geeksamu

関連する問題