1

I'm trying to access a mysql database using ruby with ActiveRecord. The ruby file is dbtest.rb.

require 'rubygems' require 'active_record' ActiveRecord::Base.establish_connection( :adapter => "mysql2", :host => "localhost", :database => "students" ) class Rubyist < ActiveRecord::Base end 

When I try to load this file via irb or run it using ruby I get the following error:

.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` 

I've installed both the mysql2 gem and activerecord-mysql2-adapter successfully. When I installed the activerecord-mysql2-adapter I received the following messages:

gem install activerecord-mysql2-adapter Fetching: activerecord-mysql2-adapter-0.0.3.gem (100%) Successfully installed activerecord-mysql2-adapter-0.0.3 1 gem installed 

Do I need to rename the adapter?

2
  • Pls run 'bundle update'. Commented Feb 6, 2013 at 1:01
  • I'm not using Rails, therefore I don't have a Gemfile and doesn't Bundle require a Gemfile? Commented Feb 6, 2013 at 1:56

1 Answer 1

2

I added "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH" to my .bash_profile which fixed it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.