Advertisements

mysql driver

Postby shinsyotta » Mon Jun 01, 2009 4:10 am

Offline
shinsyotta
Posts: 1
Joined: Mon Jun 01, 2009 3:32 am
I'm working on this tutorial: http://www.tutorialspoint.com/ruby-on-r ... ations.htm

my-macbook-pro:library myusername$ rake db:migrate
(in /Users/myusername/Sites/library)
!!! 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!
no such file to load -- mysql

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

Looks like the MySQL driver isn't installed. I wanted to find which location is running Ruby, etc, so... here are the answers:

my-macbook-pro:library myusername$ which ruby
/usr/local/bin/ruby
my-macbook-pro:library myusername$ which gem
/usr/local/bin/gem
my-macbook-pro:library myusername$ which mysql
/usr/local/mysql/bin/mysql
my-macbook-pro:library myusername$ which rails
/usr/local/bin/rails

So I move to the bin folder:
my-macbook-pro:bin myusername$ ls -a
. erb irb rake ri testrb
.. gem rails rdoc ruby
my-macbook-pro:bin myusername$ pwd
/usr/local/bin

...and try to install the mysql gem:

my-macbook-pro:bin myusername$ sudo gem install mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.7/gem_make.out

Then I cd to the library folder (my app's name) and do a rake and this is what happens:

my-macbook-pro:bin myusername$ cd ~/Sites/library/
my-macbook-pro:library myusername$ rake db:migrate
(in /Users/myusername/Sites/library)
!!! 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!
no such file to load -- mysql

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

So it seems MySQL gem is still not installed properly. Anybody got any ideas? It seems that I'm missing something or doing something wrong.

Postby tutorialspoint » Mon Jun 01, 2009 7:09 pm

Offline
tutorialspoint
Site Admin
Posts: 143
Joined: Fri Apr 27, 2007 6:52 pm
Dear,

Iwould not be able to help you but that's for sure you have some installation problem. I would suggest to start with a fresh installation of all the components.

Thanks
Moderator, TP
Keep visiting and share this site with your friends.

I had the same issue

Postby Subtle81 » Wed Sep 01, 2010 5:20 pm

Offline
Subtle81
Posts: 2
Joined: Wed Sep 01, 2010 5:18 pm
I had to install the gem mysql2 instead and this solved the issue for me.

Also make sure the gemfile says mysql2