[英]bundle exec rake db:setup, Rake tasks not supported by 'username' adapter
当我尝试运行bundle exec rake db:setup
,它给了我这个错误
当我将适配器更改为我的用户名时,出现了相同的错误
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'] %>
PG :: InsufficientPrivilege:错误:拒绝创建数据库的权限
这里的问题是您没有足够的权限给Postgres上的freelance_camp_documents
用户。
我建议将用户freelance_camp_documents
权限从postgres更改,或仅将用户名更改为postgres
production:
<<: *default
database: freelance_camp_documents_production
username: postgres
password: <%= ENV['FREELANCE_CAMP_DOCUMENTS_DATABASE_PASSWORD'] %>
postgres
用户默认具有权限,因此您无需更改任何内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.