Forum: Ruby ActiveRecord Problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
425cab08658a06567879717de154552c?d=identicon&s=25 Ari Brown (Guest)
on 2007-07-24 22:30
(Received via mailing list)
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
F05add2c1c1b613e8e318e9360eac5c2?d=identicon&s=25 Travis D Warlick Jr (Guest)
on 2007-07-24 22:36
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ari Brown wrote:
>
> 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."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGpmJbWvapaOIz2YYRAnlBAJ4yUoFYyf9p54mdWNcj6lfEt3R+/gCdF7o9
hTHp3KYKSZdnwb/Cz+Qddxo=
=o3g3
-----END PGP SIGNATURE-----
425cab08658a06567879717de154552c?d=identicon&s=25 Ari Brown (Guest)
on 2007-07-24 22:43
(Received via mailing list)
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?

aRi
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.
Ae82cad40a0caca9c932d45c7a9eb3cd?d=identicon&s=25 Michael Glaesemann (Guest)
on 2007-07-24 23:10
(Received via mailing list)
On Jul 24, 2007, at 15:41 , Ari Brown wrote:

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

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
90a73d9875462aaa9fab2feffafbffe7?d=identicon&s=25 Ben Bleything (Guest)
on 2007-07-24 23:22
(Received via mailing list)
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
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-07-25 03:26
(Received via mailing list)
On Jul 24, 2007, at 4:20 PM, Ben Bleything wrote:

> 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
>
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.
425cab08658a06567879717de154552c?d=identicon&s=25 Ari Brown (Guest)
on 2007-07-26 01:59
(Received via mailing list)
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
Ff9e18f0699bf079f1fc91c8d4506438?d=identicon&s=25 James Britt (Guest)
on 2007-07-26 02:32
(Received via mailing list)
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
This topic is locked and can not be replied to.