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 Mysql
Yes, I saw a similar error message, looking for the same nonexistent class MysqlCompat::MysqlRes
As it turns out, that class should not exist; the error message is caused by a problem with the latest Mysql driver. mysql-2.8.1 looked for my libraries in a directory named with an extra level of 'mysql' at the end. For instance, my libraries (under MacOS X 10.5.8), are in /usr/local/mysql/lib, but the mysql.bundle library looks for the MySQL libraries at /usr/local/mysql/lib/mysql ... which is wrong.
I found it easy enough to fix, by creating a symbolic link in the /usr/local/mysql/lib named 'mysql', which points to '.'
So when the libraries are referenced at that extra depth, they are found, and work. This is definitely a hack; I'm sure there are more appropriate ways to fix this. I just need it to work so I can get on with other things.
Moreover, this may not work for you. It is likely to work if your error looks like:
./mysql.bundle: dlopen(./mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib (LoadError)
Referenced from: /Users/ccullen/Projects/npapp-v2/mysql-ruby-2.8.1/mysql.bundle
Reason: image not found - ./mysql.bundle
from test.rb:5
Since this seems to be a recent development and I hadn't seen any direct response to it, I thought I'd share how I fixed it. Good luck :)