Db connection problem: Mac X, MySQL 5, Rails 1


#1

This has taken me quite a bit of time to sort out. The problem is this:

Whenever my Rails app tries to query the db, it hangs forever.

Having searched 5000+ emails to this group, I’ve not found an answer to
my
problem. I’d be happy to turn on logging, but can’t seem to get the Mac
install of MySQL to boot up with the --log option set. I tried running
mysqld and mysql_safe manually, but encountered a frustrating lock.pid
file
problem.

There are no error messages printed to the screen, nor are there any
messages in the WebRick monitor. (Oh yeah… I’m using WebRick). I
tested
Rails without a db-hit, and it worked fine.

Anyone got any ideas?


#2

Doug,

Did you ever resolve this problem? I’m having what sounds to be the
same problem.

I’ve followed this installation guide:
http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger

and when I attempted to follow this tutorial:
http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html

I encounter the same problem you describe the first time I try to
connect to a database.

I’m using OS X 10.4.4, mysql 4.1.15, Ruby 1.8.2 (even though the above
setup tutorial apparently had me install 1.8.4, rails_info/properties
says it’s 1.8.2), Rails 1, RubyGems 0.8.10.

If Doug, or anyone else has any suggestions for resolving this, it would
be greatly appreciated, as it’s a very frustrating problem!

Thanks,

Graeme

Doug Hernandez wrote:

This has taken me quite a bit of time to sort out. The problem is this:

Whenever my Rails app tries to query the db, it hangs forever.

Having searched 5000+ emails to this group, I’ve not found an answer to
my
problem. I’d be happy to turn on logging, but can’t seem to get the Mac
install of MySQL to boot up with the --log option set. I tried running
mysqld and mysql_safe manually, but encountered a frustrating lock.pid
file
problem.

There are no error messages printed to the screen, nor are there any
messages in the WebRick monitor. (Oh yeah… I’m using WebRick). I
tested
Rails without a db-hit, and it worked fine.

Anyone got any ideas?


#3

I had (3-4 months ago) what sounds like a similar problem (I’m running
OS X 10.4). I had to actually build the mysql connector on my box for
it to work properly. I don’t have any references for you but you should
be able to find something on Google. That’s where I looked.


#4

Worked first time, exactly as you described!

Thanks very much, you’ve saved me from a weekends worth of hair pulling.

Cheers,

Graeme


#5

Hold it! I did find this. You need XCode installed to do this:

Download and unpack this:

http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.7.tar.gz

cd to the unpacked directory and do this:

sudo gcc_select 4.0

export PATH=/usr/local/mysql/bin:$PATH

ruby extconf.rb --with-mysql-config

make

sudo make install


#6

Rick, et al. I stumbled across this thread when looking for info on this
error:

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:1079:
[BUG] Bus Error

My server (WEBrick) would hang on anything other than localhost:3000,
but the description of your problem may be what’s happening. I began the
process you’ve outlined, but then get an error:

can’t find header files for ruby.

when attempting to run:

ruby extconf.rb --with-mysql-config

Any thoughts as to what might be happening?

I’ve set up my rails config following the hivelogic
tutorial
, and had mysql access issues for a while initially.

Rick Williams wrote:

Hold it! I did find this. You need XCode installed to do this:

Download and unpack this:

http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.7.tar.gz

cd to the unpacked directory and do this:

sudo gcc_select 4.0

export PATH=/usr/local/mysql/bin:$PATH

ruby extconf.rb --with-mysql-config

make

sudo make install