简体   繁体   English

Heroku耙db:structure:load与cleardb找不到'mysql'

[英]Heroku rake db:structure:load with cleardb can't find 'mysql'

I am trying to install an instance of Sharetribe on a heroku dyno. 我正在尝试在heroku dyno上安装Sharetribe的实例。 I am at the point where I am trying to create the database. 我正在尝试创建数据库。 I first tried rake db:migrate and it worked for most of the migrations but failed on one of them. 我首先尝试了rake db:migrate,它适用于大多数迁移,但是其中之一失败了。

I was advised to use rake db:structure:load, so I tried that and I am getting an error from Heroku saying that mysql needs to be added to the PATH variable. 有人建议我使用rake db:structure:load,所以我尝试了一下,并且从Heroku中收到一条错误消息,要求将mysql添加到PATH变量中。 Why is this, and how can I fix it? 为什么会这样,我该如何解决? I'm not sure why it happens on db:schema:load and db:structure:load but not on db:migrate. 我不确定为什么会在db:schema:load和db:structure:load上发生而不是在db:migrate上发生。

The complete stack trace with the error message is: 带有错误消息的完整堆栈跟踪为:

rake aborted!
failed to execute:
mysqlPlease check the output above for any errors and make sure that `mysql` is installed in your PATH and has proper permissions.

/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/mysql_database_tasks.rb:148:in `run_cmd'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/mysql_database_tasks.rb:72:in `structure_load'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:189:in `structure_load'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:222:in `load_schema_for'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:236:in `block in load_schema_current'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:276:in `block in each_current_configuration'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:275:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:275:in `each_current_configuration'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:235:in `load_schema_current'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:293:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => db:structure:load
(See full trace by running task with --trace)

Thanks! 谢谢!

If you need to run heroku run bundle exec rake db:structure:load than you need to install mysql client. 如果您需要运行heroku run bundle exec rake db:structure:load不是安装mysql客户端。 To install additional packages you need to add Buildpacks (official or community based). 要安装其他软件包,您需要添加Buildpacks (基于官方或社区)。

For mysql I successfully used https://github.com/din-co/heroku-buildpack-mysql 对于mysql,我成功使用了https://github.com/din-co/heroku-buildpack-mysql

heroku buildpacks:add --index 1 https://github.com/din-co/heroku-buildpack-mysql
git commit --amend --allow-empty --no-edit
git push heroku -f

Heroku doesn't support mysql , you need to use pg gem in your gemfile in production block. Heroku不支持mysql ,您需要在生产模块的gemfile中使用pg gem。 Please read Getting Started with Rails 5.x on Heroku 请阅读Heroku上的Rails 5.x入门

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM