简体   繁体   English

Rails-MySQL错误 - 未初始化的常量MysqlCompat :: MysqlRes

[英]Rails-MySQL Error - uninitialized constant MysqlCompat::MysqlRes

Trying to get a Rails app running on Snow Leopard. 试图在Snow Leopard上运行Rails应用程序。

  • Downloaded mysql-5.5.8-osx10.6-x86_64.dmg and ran installer 下载mysql-5.5.8-osx10.6-x86_64.dmg并运行安装程序
  • Ruby 1.8.7 (Default OS X version) Ruby 1.8.7(默认OS X版)
  • Rails 2.3.5 Rails 2.3.5

When I attempt to run "rake db:migrate" I get 当我尝试运行“rake db:migrate”时,我得到了

  • rake aborted! 耙子流产了!
  • uninitialized constant MysqlCompat::MysqlRes 未初始化的常量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. 我已经查看了以下链接,并按照其中包含的步骤进行操作,每次结果都相同。

Prior to the following commands I run "sudo gem uninstall mysql" followed by "sudo gem clean mysql" based on the above links: 在以下命令之前,我运行“sudo gem uninstall mysql”,然后根据以上链接运行“sudo gem clean mysql”:

  • sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config 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 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. 我刚刚感到沮丧,非常感谢任何帮助。

Many thanks! 非常感谢!

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 : 没有我自己的经验,我使用Snow Leopard,RVM和rails 2.3.5到3.0.3,但找到了另一个处理卸载和重新安装的视图:

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

For more details see the posting at: http://accidentaltechnologist.com/apple/fixing-uninitialized-constant-mysqlcompatmysqlres-error-on-snow-leopard/ 有关详细信息,请参阅发布在: http//accidentaltechnologist.com/apple/fixing-uninitialized-constant-mysqlcompatmysqlres-error-on-snow-leopard/

For El Capitan you don't need to uninstall / install. 对于El Capitan,您无需卸载/安装。

Just found your libmysqlclient.18.dylib file. 刚刚找到你的libmysqlclient.18.dylib文件。 Location will depent on how you installed mysql 位置将取决于你如何安装mysql

locate libmysqlclient.18.dylib

Once you have the path create a symb link as: 获得路径后,创建一个symb链接:

ln -s /usr/local/mysql-5.5.20-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

You have two change first param according to your dynamic library location (use the first command). 根据动态库位置,您有两个更改第一个参数(使用第一个命令)。

On El Capitan the link should be to /usr/local/lib . 在El Capitan上,链接应该是/usr/local/lib On previous versions link was to /usr/lib/ 在以前的版本链接到/usr/lib/

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

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