ActiveRecord Problem

Ugh. ActiveRecord is giving me a hard time.

I go to connect to my mysql database on localhost, and I get rejected!
Actual IRB session:
character.rb(main):015:0* class Character < ActiveRecord::Base; end
=> nil
character.rb(main):016:0> puts Character.find(:first).firstn
Errno::ENOENT: No such file or directory - /tmp/mysql.sock
         from /usr/local/lib/ruby/1.8/mysql.rb:99:in `initialize'
         from /usr/local/lib/ruby/1.8/mysql.rb:99:in `new'

So, uh, what exactly is it saying? I just installed MySQL through the directions (word for word) from the Apple website.

Ruby 1.8.6, Mac, OS X powerpc

Thanks,
aRi
-------------------------------------------|
Nietzsche is my copilot

Ari Brown wrote:

Ugh. ActiveRecord is giving me a hard time.

I go to connect to my mysql database on localhost, and I get rejected!
Actual IRB session:
character.rb(main):015:0* class Character < ActiveRecord::Base; end
=> nil
character.rb(main):016:0> puts Character.find(:first).firstn
Errno::ENOENT: No such file or directory - /tmp/mysql.sock
        from /usr/local/lib/ruby/1.8/mysql.rb:99:in `initialize'
        from /usr/local/lib/ruby/1.8/mysql.rb:99:in `new'

So, uh, what exactly is it saying? I just installed MySQL through the
directions (word for word) from the Apple website.

It's saying that it can't find the MySQL socket. Check your connection
configuratiosn for ActiveRecord. See the api for
ActiveRecord::Base.establish_connection

- --
  Travis Warlick

  "Programming in Java is like dealing with your mom --
   it's kind, forgiving, and gently chastising.
   Programming in C++ is like dealing with a disgruntled
   girlfriend -- it's cold, unforgiving, and doesn't tell
   you what you've done wrong."

How can ActiveRecord not be up-to-date to connect to my MySQL?
Here's the error when I - not connect - but try to query the database.

CODE
character.rb(main):018:0* puts Character.find(:first).firstn
Mysql::Error: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Bwah? Not QUITE sure what that means, but I have a hunch that it's bad.

Thanks,
-------------------------------------------------------|
~ Ari
crap my sig won't fit

Thanks. Do you know why Mac OS X doesn't have /tmp/mysql.sock?

aRi
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.

···

On Jul 24, 2007, at 4:34 PM, Travis D Warlick Jr wrote:

It's saying that it can't find the MySQL socket. Check your connection
configuratiosn for ActiveRecord. See the api for
ActiveRecord::Base.establish_connection

Ari Brown wrote:

How can ActiveRecord not be up-to-date to connect to my MySQL?
Here's the error when I - not connect - but try to query the database.

CODE
character.rb(main):018:0* puts Character.find(:first).firstn
Mysql::Error: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Bwah? Not QUITE sure what that means, but I have a hunch that it's bad.

Mysql change how it handled password encryption somewhere between version 3.x and 5.y.

If you are using an older version of ActiveRecord you may have to update AR or tell Mysql to use the older style of password encoding.

James

Maybe your MySQL server isn't started? Can you connect to the MySQL server through it's command line client? (I assume it has one.)

Michael Glaesemann
grzm seespotcode net

···

On Jul 24, 2007, at 15:41 , Ari Brown wrote:

Thanks. Do you know why Mac OS X doesn't have /tmp/mysql.sock?

The socket location is configurable, and I think by default it puts it
somewhere in /var. If you installed via DP or Fink, it's probably
somewhere else in /opt/local. Do a locate for mysql.sock and you might
find it, otherwise go have a peek at your mysql config.

Ben

···

On Wed, Jul 25, 2007, Ari Brown wrote:

On Jul 24, 2007, at 4:34 PM, Travis D Warlick Jr wrote:
>It's saying that it can't find the MySQL socket. Check your
>connection
>configuratiosn for ActiveRecord. See the api for
>ActiveRecord::Base.establish_connection

Thanks. Do you know why Mac OS X doesn't have /tmp/mysql.sock?

did you install on OS X using the MySQL OS X installer?
if so, it comes with several GUI tools and a System Preferences pane for starting and stopping the MySQL server app.
it's pretty cool and useful, and it is the best way to start/stop MySQL on OS X.
you do also have to make sure ActiveRecord knows the username and password for MySQL,
I don't know how to do this part outside of Rails.
I haven't tried using ActiveRecord independently of Rails, but as cool and useful as it is in Rails, it must be equally great outside of Rails. Sure beats using SQL all the time.

···

On Jul 24, 2007, at 4:20 PM, Ben Bleything wrote:

On Wed, Jul 25, 2007, Ari Brown wrote:

On Jul 24, 2007, at 4:34 PM, Travis D Warlick Jr wrote:

It's saying that it can't find the MySQL socket. Check your
connection
configuratiosn for ActiveRecord. See the api for
ActiveRecord::Base.establish_connection

Thanks. Do you know why Mac OS X doesn't have /tmp/mysql.sock?

The socket location is configurable, and I think by default it puts it
somewhere in /var. If you installed via DP or Fink, it's probably
somewhere else in /opt/local. Do a locate for mysql.sock and you might
find it, otherwise go have a peek at your mysql config.

Ben