私は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'] %>
を変更する必要はありませんので、ユーザは、デフォルトで権限を持つのpostgresからユーザー
freelance_camp_documents
ための権限を変更することをお勧めまたはちょうどpostgres
postgres
にユーザー名を変更します'開発'モードで動作します。このモードでは、 'database.yml'にユーザ名を指定していません。 – 31piy@ 31piy私はdatabase.ymlファイルから気づきましたが、devモードをどのように実行するのですか?私は 'bundle exec rake db:setup 'という行を端末で実行してこのエラーが出たので、まだサーバを稼働していません。 – geeksamu
これはサーバーの実行には関係ありません。 'database.yml'ファイルで使用するユーザを指定する必要があります。これにより、DBがそのDBを設定できるようになります。このためにあなたのpostgres設定にアクセスする必要があります。 – 31piy