www.tutorialspoint.com Forum Index
Register FAQMemberlistUsergroupsTutorials PointLog in
Reply to topic Page 1 of 1
mysql driver
Author Message
Reply with quote
Post mysql driver 
I'm working on this tutorial: http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-migrations.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.

View user's profile Send private message
Reply with quote
Post  
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.
View user's profile Send private message Send e-mail
Reply with quote
Post I had the same issue 
I had to install the gem mysql2 instead and this solved the issue for me.

Also make sure the gemfile says mysql2

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum