Wednesday, March 23, 2011

uninitialized constant Mysql::Error - OSx snow leopard

You will run into this issue if you are using:

Mysql -> 5.5.x

rake db:create --trace
(in /Users/toamitkumar/development/rails_apps/mongotimeline)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
uninitialized constant Mysql::Error

spent 2 hours to figure out the issue is with 64 bit architecture on OSx. It is not able to find dynamic library libmysqlclient. Making the following entry in .bashrc file and then installing the mysql gem again solved the problem.

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"

$ sudo env ARCHFLAGS="-arch x86_64"

$ gem install
--no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config


Rock on !!

2 comments:

hawra said...

Your solution didn't work for me. Exact same problem.
Mac ox 10.6.7, Mysql gem 2.8.1, Mysql 5.5.13 64 bit.
If you can help me I
d greatly appreciate it. I'll send you a Linked-in mail message .
Thanks in advance.
Randy Hawkins

Amit Kumar said...

Whatz the problem you faced ?
Did you get it to work ?