Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uninitialized constant MysqlCompat::MysqlRes (using mms2r gem)

Tags:

moved a rails app of mine onto a new server and had to install a few gem dependencies. However, after installing the mysql gem I get the error, uninitialized constant MysqlCompat::MysqlRes, whenever I try to run a rake command that involves the mysql database. It seems I only get this error when I require the mms2r gem. Has anyone ever heard of this? I'm running mysql 2.8.1 gem.

like image 291
Anon Avatar asked Aug 26 '09 03:08

Anon


2 Answers

on my Mac OS X 10.6 I did this to install the 2.8.1 gem, which worked perfectly with my MacPorts mysql5-server:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql 
like image 180
Markus Strauss Avatar answered Oct 10 '22 05:10

Markus Strauss


Basically the problem is the the dynamic library libmysqlclient can't be found. The above solutions will work, but you need to reapply them any time you rebuild the gem, or when you install a new version of MySQL.

An alternative approach is to add the MySQL directory containing the library to your dynamic load path. Putting the following in my .bashrc file solved the problem:

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH" 
like image 33
Steven Chanin Avatar answered Oct 10 '22 04:10

Steven Chanin