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.
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.
You rock! Thanks for this. – jschorr Jun 7 at 14:54 You are a prince among men!
Thanks Steven! – andrewdotnich Oct 21 at 0:25.
OK, I've finally solved this problem. The reason this was occurring was that I had two versions of Ruby installed. I had compiled and installed my own version of Ruby following the pre my installation of Snow Leopard.
I then upgraded to Snow Leopard (which has it's own version of Ruby) These two versions conflicted and meant that when ever I tried to install the the MySQL gem with the correct ARCHFLAGS the system thought I was using a different version of Ruby. The fix was simple enough: Remove the veLogic version of Ruby (http://pivotallabs.com/users/chad/blog/articles/407-removing-old-ruby-source-installation-after-a-leopard-upgrade) Recompile the MySQL gem with the correct ARCHFLAGS: sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Once I had done this everything worked fine. Hope it works for you to.B.
1 I found out that just recompile step #2 solve my problem, Thank you for you post. – Jirapong Mar 20 '10 at 3:48 also recompiled with given command and working fine. Thank you.
– PowerKiKi Jan 5 at 21:03.
Well, I am a newbie. After struggling for a while and since none of the above worked for me, I figured the problem was due to my "mysql" being a 64-bit installation while ruby was 32-bit. Check with these commands file `which mysql` file `which ruby` Both should match Mach-O 64-bit executable x86_64 or Mach-O 64-bit executable i386.
I installed a 32-bit mysql, reinstalled ruby from source and rails and things have been working flawlessly since. I am on Leopard btw.
Bless you and all that you stand for. I've been banging my head against this problem all afternoon and you finally solved it for me. I wish I could give more than just one upvote.
– abeger Jun 11 '10 at 19:33 1 @abeger, I have given him/her an upvote for you. – Yar Nov 17 '10 at 22:37.
After wrestling with this problem for several days I finally got it nailed. 2 things that I have done that made it work: sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH" I'm a bit surprised that #2 was only mentioned by Steven Chanin. I'm on Snow Leopard, and have only 1 MySQL (x86_64) 5.5, and 1 ruby (prepackaged with Snow Leopard) installed.
I have applied the instructions of hivelogic post but with version 5.1.41 of MySQL. And for the gem installation I did 2 things: sudo gem uninstall mysql sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config And things worked great for me.
Thanks khell - yeah this is weird. I still have the same problem for some reason my system just does like it. I tried a rake db:drop and get: mysystem$ rake db:drop (in /Users/username/devel/rails/myproj/trunk) Couldn't drop myproj : # Any other ideas?
Thank – emson Dec 22 '09 at 23:10 did you try with version 5.1.41? Also before that make sure you delete everything on /usr/local/mysql not to mix the build file. – khelll Dec 23 '09 at 0:03.
Same problem here as well; have been wrestling with this off and on for over two weeks! I'm no ROR expert, but from other more knowledgeable people who found a solution, the problem seems to point the Ruby Gem for mysql which, apparently, incorrectly installs itself on the Mac. I will continue to investigate at the Ruby Forge site, and see if any Ruby Gem gurus can correct this horrible bug....I need my Rails working!
Time is money! So I reported this bug over at the RubyForge Mysql developers bug tracking page. I sure hope they can help, as this is crippling my current project.
And if anyone else can support my bug report over there, perhaps it will get more attention; please chime in!
After racking my head with the problem, I too found that the problem had to do with multiple binaries of the same mysql gem version installed. The following fixed it for me. Gem uninstall mysql Select gem to uninstall: 1.
Mysql-2.8.1 2. Mysql-2.8.1 3. All versions > 3 Successfully uninstalled mysql-2.8.1 Successfully uninstalled mysql-2.8.1 Next, I recompiled the mysql gem from source on my Snow Leopard machine, and all was swell with the world.
Sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql-5.1.46-osx10.6-x86_64/bin/mysql_config.
This can be a Mysql version problem. You should install the most stable version (MYSQL 5.1). See my blog post : geryit.com/blog/2011/01/installing-mysql....
If you're using MySQL 5.5, these are the steps that made it work for us: code to install mysql-2.8.1: sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config code to make mysql-2.8.1 work with mysql 5.5: sudo ln -s ../mysql/lib/libmysqlclient.16. Dylib libmysqlclient.16. Dylib Hope that helps!
Thanks khell - but I'm still getting this problem. It's really baffling. This is a synopsis of what I've done so far to fix it: Uninstalled MySQL 5.1.41.1, using make uninstall as it suggests in the hivelogic post.
Deleted all remaining files from the /usr/local/mysql directory Reinstalled MySQL 5.1.39 Tested the database, all works fine, I can use it with Django. Uninstalled the ruby mysql gem Reinstalled the ruby mysql gem (2.8.1) (also tried 2.7 - no joy either). These are the various commands I tried.
I uninstalled and before trying each one: sudo gem install --no-rdoc --no-ri mysql -v 2.7 -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -v 2.7 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config export ARCHFLAGS="-arch i386 -arch x86_64" sudo gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config sudo env ARCHFLAGS="-arch i386 -arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config This is what happens when I try and use the db commands in rake: computer01:trunk bently$ rake db:create (in /Users/bently/devel/rails/project/trunk) Couldn't create database for {"adapter"=>"mysql", "username"=>"root", "database"=>"project_dev", "host"=>"localhost", "password"=>nil, "socket"=>"/tmp/mysql. Sock"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation) computer01:trunk bently$ But when I do a rake db:collation I get the usual error: computer01:trunk bently$ rake db:collation (in /Users/bently/devel/rails/project/trunk) rake aborted! Uninitialized constant MysqlCompat::MysqlRes (See full trace by running task with --trace) computer01:trunk bently$ Is there any way I can see what is happening, any logging or verbose in information?
Anyone got any ideas? I'm really struggling to figure this out. Many thanks.
I worked pretty hard getting this resolved for the last day and I finally figured it out. I'm running snow leopard and did a fresh rails and mysql install. The only way I got this to work was to install the 64bit version of mysql from the dmg (not macports) and restart my machine in 64 bit mode by holding the "6" and "4" keys down while booting.
Then I installed the gem, set my DB host to local and it worked like a champ.
Several problems were related to obsolete or multiple conflicting binaries of rubies and gems. I have myself had the problem to "transparently" compile the mysql gem with the system ruby, while trying to get my code run with ruby 1.9. After figuring out the problem thanks to this thread, everything went smoothly.To avoid these issues and for the records, the RVM toolkit may be very handy: rvm.beginrescueend.com. It helps in properly managing several ruby versions, and it cleverly manages gems for all versions without keeping a copy for each version.
It seems that the use of RVM can help in avoiding several of the issues in this thread.
In case someone is using rvm with ruby 1.8.7 and mysql x86 (32 bits version) and have this issue. You will find this link helpful: rvm.beginrescueend.com/integration/datab... . You will need to install mysql in x86_64 version and then install the mysql gem with the archflags set to x86_64.
The reason is that even you try to install the gem as x86 to match your mysql x86. However the ruby version is in 64 bits. So you really need to have all three match: Ruby, mysql and mysql gem.So the easier way is to have all of them in 64 bits.
Very quick fix for me. This problem popped up on me again this week on a development machine I'd not used for sometime. As per Step 2 of emson's initial response, it only required a recompiling of the MySQL gem with the correct ARCHFLAGS: sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config.
I had this, or at least a similar, issue (velogic was not involved and it was not an upgrade, but rather a new system). I agree that it is probably a 64 bit issue. I have a link for you, that after all the other head and butt scratching I did, finally saved my ass (and brain).
forums.mysql.com/read.php?116,359591,359591 Best of luck getting past this configuration BS and on to some coding.
After searching for a long time on solving this particular problem, and trying out all of the above options (and the options on many other sites) without luck, I removed my mysql-5.5 install and installed mysql-5.1. All of a sudden, and with a bit of the above help for compiling 64 bit versions, I finally managed to install a working mysql gem. So, if you're running into this problem and are running mysql 5.5, try degrading to mysql 5.1.
I had the same issue. I had installed mysql (in my case, 5.1.48 64-bit for Snow Leopard) in /usr/local/mysql/current/, not in /usr/local/mysql. However, the mysql client shard library (libmysqlclient.16.
Dylib) had a path of /usr/local/mysql/lib/libmysqlclient.16. Dylib embedded in it. After several abortive attempts to fix this using install_name_tool, what worked was to both change the path in the shared library as follows, and then rebuild the mysql 2.8.1 rubygem, specifying both my: # change the path embedded in libmysqlclient.
Dylib sudo install_name_tool -change /usr/local/mysql/lib/libmysqlclient.16. Dylib /usr/local/mysql/current/lib/libmysqlclient.16. Dylib /usr/local/mysql/current/lib/libmysqlclient.16.
Dylib # reinstall the mysql gem sudo ARCHFLAGS="-arch i386 -arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql/current --with-mysql-config=/usr/local/mysql/current/bin/mysql_config Note that this is based on having mysql installed in /usr/local/mysql/current, you'll need to edit the paths to be appropriate for your system.
There is a chance that you followed the above instructions but forgot to kill the server before reinstalling Mysql. This will not make the error message go away. This happened to me.
After trying out all the different options here, I tried the following: ps aux | grep 'mysql' kill pid_number_for_mysql Basically, kill the server.. the hard way. Then, restart the server.
I've got a problem trying to install the Ruby mysql gem driver. I recently upgraded to Snow Leopard and did the Hivelogic manual install of MySQL. This all seems to work fine as I can access mysql from the command line and make changes to the database.
Now it appears that my mysql gem isn't working correctly as I can access MySQL fine from Python using the Python driver (which I compiled to). And I have removed all other instances of the mysql gem, from my system. Any suggestions would be greatly appreciated.
PS I saw this previous post http://stackoverflow.com/questions/1332207/uninitialized-constant-mysqlcompatmysqlres-using-mms2r-gem but it doesn't seem applicable for my version.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.