# CANNOT get Ruby to work with SQL

**URL:** <https://www.ruby-forum.com/t/cannot-get-ruby-to-work-with-sql/136383>\
**Category:** Ruby\
**Created:** [May 1, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/cannot-get-ruby-to-work-with-sql/136383 "2008-05-01T13:59:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cornelombaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cornelombaard](https://www.ruby-forum.com/u/cornelombaard)\
**Post date:** [May 1, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/cannot-get-ruby-to-work-with-sql/136383/1 "2008-05-01T13:59:29Z")

</div>

Please can someone help me?

I get the following error message when I start the rails server and I  
click on About your application environment.

Errno::ENOENT in Rails/infoController#properties

No such file or directory - /tmp/mysql.sock

RAILS\_ROOT: /home/corne/Studies/Ruby/Sites/demo

If I did a mysql\> show variables like ‘%sock%’ I get  
the following:

/var/lib/mysql/mysql.sock

I do not know anything about Ruby, Linux, Sockets or the rest. Please  
can someone tell me where to put this information or how do I setup my  
database so that it works with Ruby?

---

<div class="post-metadata">

**Author:** ![cornelombaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cornelombaard](https://www.ruby-forum.com/u/cornelombaard)\
**Post date:** [May 1, 2008, 2:23pm UTC](https://www.ruby-forum.com/t/cannot-get-ruby-to-work-with-sql/136383/2 "2008-05-01T14:23:43Z")

</div>

Rails apps use a database configuration file,  
/config/database.yml. When using mysql, there’s  
often a line in the file for each database like

socket: /tmp/mysql.sock

You could replace that path with the one from your error message,  
/var/lib/mysql/mysql.sock. Alternatively, you could just remove the  
“socket”  
lines from the file. I’m on Mac OS X, and I installed mysql via  
macports. I  
find that I don’t need to specify the location of the socket, so I just  
delete that line.

For future issues with Rails, you should consult the rails-talk mailing  
list, [http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk) .

Good luck,  
Craig

---

<div class="post-metadata">

**Author:** ![cornelombaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cornelombaard](https://www.ruby-forum.com/u/cornelombaard)\
**Post date:** [May 1, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/cannot-get-ruby-to-work-with-sql/136383/3 "2008-05-01T14:21:22Z")

</div>

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

Corne Lombaard wrote:  
| Please can someone help me?  
|  
| I get the following error message when I start the rails server and I  
| click on About your application environment.  
|  
| Errno::ENOENT in Rails/infoController#properties  
|  
| No such file or directory - /tmp/mysql.sock  
|  
| RAILS\_ROOT: /home/corne/Studies/Ruby/Sites/demo  
|  
| If I did a mysql\> show variables like ‘%sock%’ I get  
| the following:  
|  
| /var/lib/mysql/mysql.sock  
|  
| I do not know anything about Ruby, Linux, Sockets or the rest. Please  
| can someone tell me where to put this information or how do I setup my  
| database so that it works with Ruby?

A quick Google[0] shows this link:  
[http://abstractplain.net/blog/?p=973](http://abstractplain.net/blog/?p=973), which mentions that you can  
modify the database.yml file to include a path to your socket file.

Also, Rails questions (and this is a question about Rails, and not a  
general ‘Ruby and SQL’ question) are better off asked to the Rails  
community[1].

[0]  
[http://www.google.com/search?client=safari&rls=en&q=rails%20cannot%20find%20mysql%20socket&ie=UTF-8&oe=UTF-8](http://www.google.com/search?client=safari&rls=en&q=rails%20cannot%20find%20mysql%20socket&ie=UTF-8&oe=UTF-8)

[1] [Ruby on Rails — Community](http://rubyonrails.com/community)

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)

You were ever good at sudden commendations.  
~ – William Shakespeare (1564-1616), King Henry VIII  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkgZtYwACgkQbtAgaoJTgL+PWgCfYic9zpJRfbD/OSsc30zz+40/  
IikAn1cpTg/U+7qFNuGmC/4fH+JKaohq  
=ljok  
-----END PGP SIGNATURE-----
