可以了,谢谢你
现在报错:
rake aborted!
Mysql2::Error::ConnectionError: Unknown MySQL server host 'db' (-2)
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `new'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `mysql2_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:1125:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/connection_handling.rb:189:in `connection'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <main>'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/railties/databases.rake:84:in `each'
/usr/local/bundle/gems/activerecord-6.0.4.4/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <main>'
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
database.yml
default: &default
adapter: mysql2
encoding: utf8mb4
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: 123456
host: db
development:
<<: *default
database: mo_fish_backend_development
test:
<<: *default
database: mo_fish_backend_test
production:
adapter: mysql2
encoding: utf8mb4
pool: 5
host: <%= ENV['MYSQL_HOST'] || 'db' %>
database: <%= ENV['MYSQL_DATABASE'] || 'mo_fish_backend_production' %>
username: <%= ENV['MYSQL_USER'] || 'root' %>
password: <%= ENV['MYSQL_ROOT_PASSWORD'] || '123456' %>
谢谢,打扰了,请问下需要在哪个配置文件中添加呢?这个 service name 该怎么写呀?
平安夜收到了,有心了,很喜欢
填写了表单,极狐的礼物还没给我