Subscribe :: Bookmark and Share

Random ravings from

sponsors

eBay Auctions

IBM X220 EServer PIII 1.2 GHz/512 mb Server   IBM X220 EServer PIII 1.2 GHz/512 mb Server
USD$95.00 Bids: 0
Location: US
General Technics PIII 1.2 Ghz Blade Server 512MB 20G   General Technics PIII 1.2 Ghz Blade Server 512MB 20G
USD$9.00 Bids: 0
Location: US
HP DL380 G5 DUAL CORE 1.6 GHz 4GB 4x 72GB SAS Server 2U   HP DL380 G5 DUAL CORE 1.6 GHz 4GB 4x 72GB SAS Server 2U
USD$2,995.00 Bids: 0
Location: US
Tyan Server S2882-D Dual AMD Opteron 248 2.20 GHz, 8GB   Tyan Server S2882-D Dual AMD Opteron 248 2.20 GHz, 8GB
USD$750.00 Bids: 0
Location: US
Sun Fire V210 Server w/  2 x 1.34 GHz / 4Gb / 2 x 73GB   Sun Fire V210 Server w/ 2 x 1.34 GHz / 4Gb / 2 x 73GB
USD$3,400.00 Bids: 0
Location: US

13 April 2008

Installing MySQL Ruby Gem

Comments (0)

When first running Rails & Mysql, you might see thing like this in the log files.

WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C-based MySQL library instead (gem install mysql).
*

You may think.. hello... I have installed the mysql gem via 'gem install mysql'. Indeed you may have, however this WARNING message means that rails is unable to load the required libraries.

To see what is going on, fire up the console & run the following commands.
require 'rubygems'
require 'mysql'

You may see something like this.

ruby script/console
>>require 'rubygems'
[]
>>require 'mysql'
LoadError: libmysqlclient.so.15: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so
        from /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from ../../activesupport/lib/active_support/dependencies.rb:496:in `require'
        from ../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
        from ../../activesupport/lib/active_support/dependencies.rb:496:in `require'
        from (irb):3

So, Rails can see the libraries, but cannot load them.

Here is how I resolved the problem.

1. Uninstall the mysql gem - 'gem uninstall mysql'
2. Reinstall mysql like so..  'gem install mysql -- --with-mysql-lib=/usr/lib/mysql'
3. Restarted mongrel & all was good.

Thanks Ezra for your many posts.

Leave a comment
Name (required)
 
Mail (will not be published)(required)
 
Website
 

 

Back