简体   繁体   English

未初始化的常量MysqlCompat :: MysqlRes

[英]uninitialized constant MysqlCompat::MysqlRes

I am getting uninitialized constant MysqlCompat::MysqlRes when I run rake db:migrate. 运行rake db:migrate时,我得到了未初始化的常量MysqlCompat :: MysqlRes。

So here is my story. 这就是我的故事。 I upgraded my system to snow leopard and I had an existing project, which was running fine. 我将系统升级到雪豹,并且有一个现有项目,运行良好。 I was trying to upgrade some stuff, one of which was mysql to 64 bit. 我正在尝试升级一些东西,其中之一是mysql至64位。 That is when everything went wrong. 那就是一切都出错了。 So if I do the following I get the following results from my work/myproject directory. 因此,如果执行以下操作,我将从work / myproject目录获得以下结果。

file which mysql /usr/local/mysql/bin/mysql: Mach-O executable i386 file which ruby /usr/local/bin/ruby: Mach-O executable i386 哪个文件是mysql / usr / local / mysql / bin / mysql:Mach-O可执行文件i386哪个文件是ruby / usr / local / bin / ruby​​:Mach-O可执行文件i386

So I honestly don't know where I stand it this point. 因此,老实说,我不知道这一点。 I thought I installed the 64bit version of mysql but this doesn't show so. 我以为我安装了64位版本的mysql,但这没有显示出来。

I ran gem uninstall mysql and then ran sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config 我运行了gem卸载mysql,然后运行了sudo env ARCHFLAGS =“-arch x86_64” gem install mysql---with-mysql-config = / usr / local / mysql / bin / mysql_config

Did not work either! 也没有工作!

Can anyone help? 有人可以帮忙吗?

这对我有用(在OS X 10.6.6上):

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

The problem is that you need to be using the same architecture for ruby, libmysqlclient and the mysql ruby gem (i386 or x86_64). 问题是您需要对ruby,libmysqlclient和mysql ruby​​ gem(i386或x86_64)使用相同的体系结构。

I notice the ruby you've referenced is in /usr/local/bin/ruby instead of the system standard location of /usr/bin/ruby — make sure you are using the version of ruby you intended to. 我注意到您引用的红宝石位于/usr/local/bin/ruby而不是/usr/bin/ruby的系统标准位置中-请确保您使用的是预期的红宝石版本。

using i386 instead of x86_64 worked for me 使用i386而不是x86_64为我工作

sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config sudo env ARCHFLAGS =“-arch i386” gem install mysql---with-mysql-config = / usr / local / mysql / bin / mysql_config

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

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