本文介绍了Rails-MySQL错误-未初始化的常量MysqlCompat :: MysqlRes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图在Snow Leopard上运行Rails应用.

Trying to get a Rails app running on Snow Leopard.

  • 下载了mysql-5.5.8-osx10.6-x86_64.dmg并运行了安装程序
  • Ruby 1.8.7(默认OS X版本)
  • Rails 2.3.5

当我尝试运行"rake db:migrate"时,我得到了

When I attempt to run "rake db:migrate" I get

  • 耙子中止了!
  • 未初始化的常量MysqlCompat :: MysqlRes

是的,我知道这已经被问过了.我已经查看了以下链接,并按照其中包含的步骤进行操作,每次的结果都是相同的.

Yes I know this has been asked before. I have already reviewed the following links and followed the steps included in them and the result is the same each time.

  • Rails, MySQL and Snow Leopard
  • http://techliberty.blogspot.com/2009/12/dealing-with-rake-aborted-uninitialized.html
  • http://www.schmidp.com/2009/06/14/rubyrails-and-mysql-on-snow-leopard-10a380/

根据以下链接,在执行以下命令之前,我先运行"sudo gem卸载mysql",然后运行"sudo gem clean mysql":

Prior to the following commands I run "sudo gem uninstall mysql" followed by "sudo gem clean mysql" based on the above links:

  • sudo gem install mysql---with-mysql-config =/usr/local/mysql/bin/mysql_config
  • sudo env ARCHFLAGS =-arch x86_64" gem install mysql---with-mysql-config =/usr/local/mysql/bin/mysql_config

它仍然失败.我只是笨拙,将不胜感激.

It is still failing. I am just flumoxed and would greatly appreciate any help.

非常感谢!

推荐答案

我自己没有经验,我正在使用Snow Leopard,RVM和Rails 2.3.5至3.0.3,但是找到了另一种可以处理卸载的视图并通过:

Not had the experience myself and I'm using Snow Leopard, RVM and rails 2.3.5 to 3.0.3, but found another view which deals with the uninstall and reinstall via :

export ARCHFLAGS="-arch i386 -arch x86_64" ;sudo gem install --no-rdoc --no-ri -v=2.7 mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

有关更多详细信息,请参见以下发布: http ://accidentaltechnologist.com/apple/fixing-uninitialized-constant-mysqlcompatmysqlres-error-on-snow-leopard/

For more details see the posting at: http://accidentaltechnologist.com/apple/fixing-uninitialized-constant-mysqlcompatmysqlres-error-on-snow-leopard/

这篇关于Rails-MySQL错误-未初始化的常量MysqlCompat :: MysqlRes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 16:04