Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #200 (closed defect: fixed)

Opened 4 years ago

Last modified 6 months ago

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

Reported by: binaural att gmail dott kom Assigned to: David
Priority: high Milestone: 0.9
Component: ActiveRecord Version: 0.8
Severity: critical Keywords:
Cc: nahalingam@gmail.com

Description

Errno::ENOENT in Heineken#index

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

Just getting started out with rubyonrails and I get this when trying to follow a swift tutorial found here: http://darkhost.mine.nu:81/~vince/rails/tutorial.html

Thanks for any suggestions. I'm fairly confident that I have to specify a --socket flag or something similar. Thanks in advance for any enlightment.

Noah

Change History

11/14/04 04:12:46 changed by bitsweat

  • status changed from new to closed.
  • resolution set to worksforme.

Specify socket: /path/to/socket.sock in config/database.yml

production:
  adapter: mysql
  socket: /tmp/mysql.sock
  ...

11/14/04 22:54:06 changed by binaural att gmail dott kom

Thanks! Worked like a charm!

07/06/05 01:06:45 changed by anonymous

/var/lib/mysql/mysql.sock for rpm version of MySQL.

07/06/05 02:02:19 changed by bitsweat

And /var/run/mysql/mysql.sock for some others. Try running mysql_config --socket.

07/29/05 19:46:15 changed by anonymous

On Debian and Ubuntu, it's /var/run/mysqld/mysqld.sock

Shouldn't this try TCP if the socket fails? Or better yet, shouldn't it read my.cnf and get the location of the socket?

08/03/05 09:35:02 changed by sean

on mac os x with xampp, it's /Applications/xampp/xamppfiles/var/mysql/mysql.sock

just in case someone using it ...

09/04/05 22:50:57 changed by anonymous

On Suse 9.2, I set the following in database.yml: development:

adapter: mysql socket: /var/lib/mysql/mysql.sock

When I run: ruby script/generate scaffold Product Admin I get the following: Access denied for user: 'root@localhost' (Using password: NO)

Anyone know how I can fix this?

09/05/05 11:37:26 changed by anonymous

When I run: ruby script/generate scaffold Product Admin I get the following: Access denied for user: 'root@localhost' (Using password: NO

Answear: In your file database.yml you have to set a password for the root user if you have it set also on the mysql server.

04/05/06 06:51:17 changed by nahalingam@gmail.com

  • cc set to nahalingam@gmail.com.
  • priority changed from normal to highest.
  • status changed from closed to reopened.
  • resolution deleted.
  • severity changed from normal to critical.

Hi,

I got the error which has been addressed here some months before. I had read the contents given here and did the same, that is I had added socket: /var/lib/mysql/mysql.sock (I am using RPM version). But the problem has not been solved.

It is not working for me. Please help me.

04/05/06 08:49:31 changed by anonymous

  • status changed from reopened to closed.
  • resolution set to fixed.

Please don't use trac for support issues. Ask on the rails list or irc about this.

05/18/07 16:56:11 changed by marco.rossi

  • type set to defect.

I solved it thanks to the post you could find here http://rubyresponse.wordpress.com/2006/05/13/resolve-my-first-rails-problem/

Basically on debian/ubutu you should keep attention on installing mysql before rails, otherwise adding the option socket : /var/run/mysqld/mysqld.sock in database.yml could have no effects, nor adding a symbolic link to /tmp/.

I found fairly comprenshive the RoR installation procedure located https://help.ubuntu.com/community/RubyOnRails.

01/12/08 17:41:54 changed by thomasn

On Gentoo:

socket: /var/run//mysqld/mysqld.sock

03/24/08 00:45:55 changed by johnjosephbachir

for macports / darwinports on os x, it is:

/opt/local/var/run/mysql5/mysqld.sock

05/24/08 17:17:48 changed by miloso

On Mac OS X Leopard with manually downloaded (from mysql.com) and installed MySQL, is /private/var/mysql/mysql.sock the socket file. And I think this option should be mentioned at least in comments in database.yml file.

06/02/08 16:52:10 changed by charris1980

if you are using MAMP on OS X 10.5.2 for me it is "socket: /Applications/MAMP/tmp/mysql/mysql.sock". Just another FYI.