# Mysql.rb driver has been removed from Rails 2.2?

**URL:** <https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720>\
**Category:** Rails\
**Created:** [July 22, 2008, 7:44am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720 "2008-07-22T07:44:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [July 22, 2008, 7:44am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/1 "2008-07-22T07:44:54Z")

</div>

Out of nowhere I’m starting to get this error message when trying to  
access the DB (currently at rails edge):

jose@macbook [~/Development/clients/sequoyah] $ rake db:create  
(in /Users/jose/Development/clients/sequoyah)  
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please  
install the mysql gem and try again: gem install mysql.  
rake aborted!  
Failed to lookup Init function  
/usr/local/lib/ruby/site\_ruby/1.8/i686-darwin9.3.0/mysql.bundle

(See full trace by running task with --trace)

I’ve already re-installed the mysql gem a million times (uninstall and  
reinstall) and I still get this, any ideas?

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [August 14, 2008, 10:58am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/2 "2008-08-14T10:58:40Z")

</div>

I have the same problem when running script/server:  
JuicyBook:trunk justin$ script/server  
=\> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)  
=\> Rails 2.1.0 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server  
\*\* Starting Mongrel listening at 0.0.0.0:3000  
\*\* Starting Rails with development environment…  
Failed to lookup Init function  
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle  
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require’  
…

The only way I can get around this is to add the old mysql.rb file to  
your RAILS\_ROOT/lib folder (the one that was removed from edge rails).

This really bugs me though because I have to do this for every checkout,  
every branch and I need to remember to not commit it.

If anyone has a real solution it would be very helpful!

Jose F. wrote:

> Out of nowhere I’m starting to get this error message when trying to  
> access the DB (currently at rails edge):
> 
> jose@macbook [~/Development/clients/sequoyah] $ rake db:create  
> (in /Users/jose/Development/clients/sequoyah)  
> !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please  
> install the mysql gem and try again: gem install mysql.  
> rake aborted!  
> Failed to lookup Init function  
> /usr/local/lib/ruby/site\_ruby/1.8/i686-darwin9.3.0/mysql.bundle
> 
> (See full trace by running task with --trace)
> 
> I’ve already re-installed the mysql gem a million times (uninstall and  
> reinstall) and I still get this, any ideas?

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [August 14, 2008, 11:04am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/3 "2008-08-14T11:04:30Z")

</div>

And you also need to edit the mysql\_adapter.rb file line 63  
change the line into:  
require RAILS\_ROOT + “/lib/mysql.rb”

Justin Halsall wrote:

> The only way I can get around this is to add the old mysql.rb file to  
> your RAILS\_ROOT/lib folder (the one that was removed from edge rails).

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [November 26, 2008, 2:32pm UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/4 "2008-11-26T14:32:05Z")

</div>

you can go to [Ruby/MySQL](http://www.tmtm.org/en/ruby/mysql/) to download the tar  
file, and run the command below

# ruby ./install.rb

to install the mysql.rb

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [December 11, 2008, 2:27am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/5 "2008-12-11T02:27:34Z")

</div>

Weng E. wrote:

> you can go to [Ruby/MySQL](http://www.tmtm.org/en/ruby/mysql/) to download the tar  
> file, and run the command below
> 
> # ruby ./install.rb
> 
> to install the mysql.rb

Just learning so hang with me. I downloaded, unzipped and in terminal  
ran # ruby ./install.rb which returned a new command line. Is there a  
specific location the folder should sit in before the install command is  
entered or a directory I should be in first?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [November 26, 2008, 6:25pm UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/6 "2008-11-26T18:25:55Z")

</div>

This worked for me.

Thanks.

On Nov 26, 8:32 am, Weng E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [December 11, 2008, 2:15pm UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/7 "2008-12-11T14:15:56Z")

</div>

You get around this by actually installing the MySQL gem with C  
bindings. The one you guys are talking about is the pure Ruby one.

The pure-MySQL library is terrible for performance and can cause some  
seriously flaky stuff. There are a number of posts on tis list that  
discuss the installation of that library.

If you’re getting the error relating to

/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

then you have a half-installed mysql driver and I bet you’re on a Mac.

The solution that worked for me was to do this:

[http://www.napcsweb.com/blog/2007/06/01/mysql-gem-on-osx/](http://www.napcsweb.com/blog/2007/06/01/mysql-gem-on-osx/)

I hope that helps!

On Wed, Dec 10, 2008 at 7:27 PM, Shawn Cheatham

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [December 12, 2008, 12:48am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/8 "2008-12-12T00:48:00Z")

</div>

Thanks for the help - after a bit of onsite help I was able to complete  
the install. Still some quirks to be worked out but that’s the  
point…to tinker.

Thanks again

Brian H. wrote:

> You get around this by actually installing the MySQL gem with C  
> bindings. The one you guys are talking about is the pure Ruby one.
> 
> The pure-MySQL library is terrible for performance and can cause some  
> seriously flaky stuff. There are a number of posts on tis list that  
> discuss the installation of that library.
> 
> If you’re getting the error relating to
> 
> /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
> 
> then you have a half-installed mysql driver and I bet you’re on a Mac.
> 
> The solution that worked for me was to do this:
> 
> [http://www.napcsweb.com/blog/2007/06/01/mysql-gem-on-osx/](http://www.napcsweb.com/blog/2007/06/01/mysql-gem-on-osx/)
> 
> I hope that helps!
> 
> On Wed, Dec 10, 2008 at 7:27 PM, Shawn Cheatham

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [January 22, 2009, 8:59pm UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/9 "2009-01-22T20:59:59Z")

</div>

This way has worked everytime for me. Make sure the path is correct in  
your environment.

sudo gem install mysql –  
–with-mysql-config=/usr/local/mysql/bin/mysql\_config

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [January 22, 2009, 6:09pm UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/10 "2009-01-22T18:09:20Z")

</div>

I have installed rails 2.2.2 (had 2.0.1) and the mysql performance is  
very bad compared to earlier  
I takes me 10 minutes to load data into a mysql database. With 2.0.1  
it took less than 4 minutes  
The amount of save and creating operations is indicated of that the  
log file is about 2.7 MB  
I have tried to install mysql gem as proposed.

I first uninstalled mysql by  
sudo gem uninstall mysql  
I then installed it again with  
sudo env ARCHFLAGS="-arch i386" gem install mysql – --with-mysql-  
dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-  
mysql-include=/usr/local/mysql/include

but there is now change in performance  
I have Mysql 5.051, gem 1.3.1 ruby 1.8.6 rails 2.2.2

Appriciate any helps!!!

On 12 Dec 2008, 00:48, Shawn Cheatham \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [April 20, 2009, 10:33pm UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/11 "2009-04-20T22:33:25Z")

</div>

Hi there Nate,

That solution didn’t work for me with rails 2.3.2  
I get - invalid option for --with-mysql-config…

On Jan 22, 8:59 pm, Nate L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [April 18, 2009, 1:30am UTC](https://www.ruby-forum.com/t/mysql-rb-driver-has-been-removed-from-rails-2-2/143720/12 "2009-04-18T01:30:40Z")

</div>

Jumpin Jahoosefats Nate… this worked! Thanks very much!

On Jan 22, 3:59 pm, Nate L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
