Rails DB rake 任务运行但永不退出
当我运行 Rails 提供的任何 rake db
任务时,它们会成功运行但永远不会退出。我必须按 CTRL+C 才能退出任务。我测试运行了8个多小时,问题依然存在。
这是我运行 rake db:migrate --trace 时的输出:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke db:load_config
** Execute db:schema:dump
_
就像我说的,一切都按预期运行,但它在 db:schema:dump 后挂起。
我使用以下版本:
- Mac OS X 10.7.1 (Lion)
- Ruby 1.9.2p290
- Rails 3.1.0
- MySQL 5.5.14
- mysql2 gem 0.3.7
我还要注意,这是一个没有 gems/代码的基本 Rails 应用程序额外。我可以使用rails new testapp -d mysql
然后rake db:create
或bundle exec rake db:create
进行复制。
有谁遇到过这个问题或者知道我可以做些什么来进一步排除故障?
When I run any of the rake db
tasks that Rails provides, they run successfully but never exit. I have to CTRL+C to quit the task. I've tested running it for over 8 hours and the problem persists.
Here's the output if I run rake db:migrate --trace
:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke db:load_config
** Execute db:schema:dump
_
Like I said, everything runs as expected, but it hangs after db:schema:dump
.
I'm using the following:
- Mac OS X 10.7.1 (Lion)
- Ruby 1.9.2p290
- Rails 3.1.0
- MySQL 5.5.14
- mysql2 gem 0.3.7
I'll also note that this is a base Rails app with no gems/code added. I can replicate with rails new testapp -d mysql
then rake db:create
or bundle exec rake db:create
.
Has anyone run into this problem or know what I can do to further troubleshoot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了这个问题。
首先,我尝试卸载使用官方二进制文件安装的 MySQL 版本,然后使用 Homebrew 重新安装。那什么也没做。
然后我运行了brew update,重新启动了MySQL,然后再次尝试。尤里卡!它起作用了。
罪魁祸首似乎是以下其中一项旧版本中的错误:
这些是唯一更新的公式。
I fixed the problem.
First, I tried uninstalling the version of MySQL that was installed using the official binary then reinstalling using Homebrew. That did nothing.
I then ran brew update, restarted MySQL, and tried again. Eureka! It worked.
The culprit seems to have been a bug in an older version of one of the following:
Those were the only formulas that were updated.
同样的事情也发生在我身上,但不用担心,我尝试了捆绑更新之后我再也没有遇到过这个问题。
same thing happen with me also but don't worry, i tried out bundle update after this i never face this issue.