Problem with MYSQL after re-installing rails


#1

Hey all-

Re-installed OSX yesterday and with it, Ruby and Rails

Now when I try to run db:migrate I get the error message:

"!!! 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"

So, I try sudo gem install mysql – --with-mysql-dir=/usr/local/mysql

And get:
##########

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 install mysql – --with-mysql-dir=/usr/
local/mysql
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
–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.8/gems/
mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/
gem_make.out

##############

This seems to have been covered already here:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/d940897270e944e0/fcb2c750fba22014?lnk=gst&q=Could+not+create+Makefile+due+to+some+reason%2C+probably+lack+of#fcb2c750fba22014

but I can’t really follow what’s happening there :S

Could anybody advise?

Ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin8.11.1]
Rails -v: Rails 2.3.2
All gems updated


#2

Restart u’r computer or start u’r mysql server.Bassically this error
occur
due to not running of mysql server.


#3

On Apr 7, 11:59 am, Ruby R. removed_email_address@domain.invalid wrote:

Restart u’r computer or start u’r mysql server.Bassically this error occur
due to not running of mysql server.

Hog wash.

Rake aborted!

no such file to load – mysql"

So, I try sudo gem install mysql – --with-mysql-dir=/usr/local/mysql

Sorry to ask the stupid question, but have you installed mysql itself
along with everything else you did (and in that location)?

Fred


#4

Try installing the mysql gem 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

from:
http://newwiki.rubyonrails.org/database-support/mysql


#5

@frederick

Yea - installed MYSQL from the package and it is running in the system
preferences pane- basically followed the steps on dan benjamins
tutorial on installing rails on OSX tiger.

@Eric - tried the command in terminal - just got the same error.

Any suggestions guys?

thanks

On Apr 7, 12:11 pm, Frederick C. removed_email_address@domain.invalid


#6

Yea - I noticed that Dean

If you work this out before me, do let me know
I’ll be sure to do the same if I can get this working

:S

On Apr 7, 7:36 pm, Dean R. removed_email_address@domain.invalid


#7

All:

I’m encountering similar errors and difficulties. When I enter:

sudo env ARCHFLAGS="-arch i386" gem install mysql –
–with-mysql-config=/usr /local/mysql/bin/mysql_config

as many have suggested, I still get the same “can’t find header files
for ruby” error message:

Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb install mysql –
–with-mysql-config=/usr/local/mysql/bin/mysql_config
can’t find header files for ruby.

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7
for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out

Any suggestions for diagnosing my mistake here?

Thanks!

Dean R.


#8

On Apr 7, 7:21 pm, Gavin removed_email_address@domain.invalid wrote:

@frederick

Yea - installed MYSQL from the package and it is running in the system
preferences pane- basically followed the steps on dan benjamins
tutorial on installing rails on OSX tiger.

@Eric - tried the command in terminal - just got the same error.

Any suggestions guys?

using the --with-mysql-config option usually works for me (pass it
the location of the mysql_config thing). Also make sure you have the
32 bit version of mysql, not 64 bit.

Fred


#9

On Apr 7, 7:36 pm, Dean R. removed_email_address@domain.invalid
wrote:

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7
for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out

Any suggestions for diagnosing my mistake here?

That sounds like a different issue ( in Gavin’s case it just the
headers/libs for mysql it can’t locate) - maybe you don’t have all of
the stuff from the Dev tools you need ?

Fred


#10

Hmmm - have downloaded and re-installed MYSQL 5.1.33

Still getting the same issue.
In pref pane it shows that mysql is running.

Can anybody think of anything else I can check/do?

Really need to get my database back up and running soon :S

Thanks

On Apr 7, 8:31 pm, Frederick C. removed_email_address@domain.invalid


#11

On Apr 8, 12:25 am, Gavin removed_email_address@domain.invalid wrote:

Hmmm - have downloaded and re-installed MYSQL 5.1.33

but did you get the 32bit version ? (and have you tried using --with-
mysql-config=/path/to/mysql_config ?)

Fred


#12

Yea - 32 bit version

I tried installing the mysql gem with

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

and it worked! - kind of

Now when I run gem list it appears…

actionmailer (2.3.2, 2.1.0)
actionpack (2.3.2, 2.1.0)
activerecord (2.3.2, 2.1.0)
activerecord-jdbc-adapter (0.9.1)
activerecord-jdbcmysql-adapter (0.9.1)
activeresource (2.3.2, 2.1.0)
activesupport (2.3.2, 2.1.0)
arrayfields (4.7.2)
builder (2.1.2)
capistrano (2.5.5)
cgi_multipart_eof_fix (2.5.0)
chronic (0.2.3)
cucumber (0.2.3)
daemons (1.0.10)
diff-lcs (1.1.2)
fastthread (1.0.6)
fattr (1.0.3)
fixrbconfig (1.2)
gem_plugin (0.2.3)
highline (1.5.0)
hoe (1.12.1)
hpricot (0.8.1)
jdbc-mysql (5.0.4)
main (2.8.3)
mocha (0.9.5)
mongrel (1.1.5)

mysql (2.7)

net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.11)
net-ssh-gateway (1.0.1)
nifty-generators (0.2.3)
nokogiri (1.2.3)
orderedhash (0.0.6)
packet (0.1.15)
polyglot (0.2.5)
rack (0.9.1)
rails (2.3.2, 2.1.0)
rake (0.8.4)
redgreen (1.2.2)
rspec (1.2.2)
rspec-rails (1.2.2)
rubyforge (1.0.3)
rubygems-update (1.3.1)
sources (0.0.1)
sqlite3-ruby (1.2.4)
systemu (1.2.0)
term-ansicolor (1.0.3)
treetop (1.2.5)
webrat (0.4.3)
ZenTest (4.0.0)

However, when I try to run rake db:migrate or make a db query I get
this error:

!!! 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!
dlsym(0x103290, Init_mysql): symbol not found - /usr/local/lib/ruby/
gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Any ideas guys?

On Apr 8, 8:13 am, Frederick C. removed_email_address@domain.invalid


#13

VICTORY!

Installed an earlier version of MYSQL (5.0.37) and it all seems to be
working fine now

Thanks for your help fred