Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I've got a Ruby on Rails application that I am trying to run (in development) on Snow Leopard. I've got it working on my Ubuntu computer, but now I need to get my Snow Leopard environment set up.

Originally, I installed the MySQL 2.8.1 Ruby Gem and was running into this issue:

uninitialized constant MysqlCompat::MysqlRes

But thanks to this tutorial I was able to resolve it by running this command and installing a previous version of the Gem:

export ARCHFLAGS="-arch i386 -arch x86_64" ;sudo gem install --no-rdoc --no-ri -v=2.7 mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

Now that I've resolved that issue, I'm running into a different error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

This happens when I try to run rake db:migrate as well as when the server is running. How can I resolve this issue?

share|improve this question

The reason you are running into this error is because the database.yml config file of your rails application is specifying the location of the socket.

  adapter: mysql
  encoding: utf8
  reconnect: false
  database: myapp_development
  pool: 5
  username: root
  socket: /var/run/mysqld/mysqld.sock

Since your Ubuntu MySQL Socket is in a different location than your Snow Leopard MySQL Socket, you will have to create a symlink if you want to be able to share the same config file among different computers.

sudo ln -s /tmp/mysql.sock /var/run/mysqld/mysqld.sock

Note: I had to create the mysqld directory before I could put a symlink in it.

share|improve this answer
Thanks for sharing your solution. Note that you can in fact accept your own answer. – Arjan Mar 26 '10 at 6:12

Check /tmp/mysql.sock.

share|improve this answer
And how does one decide what to do with it? – Tom Wijsman Jul 13 '12 at 15:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.