# ActiveRecord Problem

**URL:** <https://www.ruby-forum.com/t/activerecord-problem/110283>\
**Category:** Ruby\
**Created:** [July 24, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/activerecord-problem/110283 "2007-07-24T22:30:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 24, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/1 "2007-07-24T22:30:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 24, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/2 "2007-07-24T22:36:34Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Ari B. 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 W.

“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](http://enigmail.mozdev.org)

iD8DBQFGpmJbWvapaOIz2YYRAnlBAJ4yUoFYyf9p54mdWNcj6lfEt3R+/gCdF7o9  
hTHp3KYKSZdnwb/Cz+Qddxo=  
=o3g3  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 24, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/3 "2007-07-24T22:43:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 24, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/4 "2007-07-24T23:10:13Z")

</div>

On Jul 24, 2007, at 15:41 , Ari B. 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 G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 24, 2007, 11:22pm UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/5 "2007-07-24T23:22:16Z")

</div>

On Wed, Jul 25, 2007, Ari B. 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

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 26, 2007, 1:59am UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/6 "2007-07-26T01:59:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 25, 2007, 3:26am UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/7 "2007-07-25T03:26:35Z")

</div>

On Jul 24, 2007, at 4:20 PM, Ben B. 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.

---

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [July 26, 2007, 2:32am UTC](https://www.ruby-forum.com/t/activerecord-problem/110283/8 "2007-07-26T02:32:36Z")

</div>

Ari B. 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
