gpt4 book ai didi

mysql - Heroku rake 数据库 :structure:load with cleardb can't find 'mysql'

转载 作者:行者123 更新时间:2023-11-29 03:47:42 25 4
gpt4 key购买 nike

我正在尝试在 heroku dyno 上安装一个 Sharetribe 实例。我正在尝试创建数据库。我首先尝试了 rake db:migrate,它适用于大多数迁移,但其中一个失败了。

我被建议使用 rake db:structure:load,所以我试了一下,但我从 Heroku 收到一个错误,说需要将 mysql 添加到 PATH 变量中。为什么会这样,我该如何解决?我不确定为什么它发生在 db:schema:load 和 db:structure:load 而不是发生在 db:migrate 上。

带有错误消息的完整堆栈跟踪是:

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)

谢谢!

最佳答案

如果你需要运行 heroku run bundle exec rake db:structure:load 比你需要安装 mysql 客户端。要安装其他包,您需要添加 Buildpacks (基于官方或社区)。

对于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

关于mysql - Heroku rake 数据库 :structure:load with cleardb can't find 'mysql' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44423906/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com