Using Xampp on Mac for Ruby on Rails

I recently installed Xampp on my mac to help with some other development work, only to find that my previous install of MySQL which I was using for Ruby on Rails development no longer worked. I was receiving errors:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

and

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

To fix the problem, I added the following line to config/database.yml

socket: /Applications/xampp/xamppfiles/var/mysql/mysql.sock

Huge thanks to http://soledadpenades.com/ who had the solution.

5 Comments

  • sole says:

    Hey there!

    It’s great that it worked for you – sorry about the pingback not working, but I was getting a LOT of spam comments and deactivated comments in old posts :-)

  • sole says:

    By the way – the coconut in your header is superb. Everything with coconut should have a bit of it :)

  • @sole. Thanks for the comment, and thanks heaps for the fix! I tried to leave a comment on your blog, but since that didn’t work I did this instead. Gotta love the coconuts :)

  • David says:

    The other thing you can do is edit the file:
    /Applications/xampp/xamppfiles/mampp

    and add the following after line 199:
    ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock

    this will create a link to mysql.sock in /tmp/ everytime mysql starts up.

  • Colby says:

    Hi Katrina,

    I’m new to Ruby but have been using xampp for on Mac OS 10.4 for awhile. WIth your post I was able to get ruby up and running. THANKS!!

Leave a comment

Your email address will not be published. Required fields are marked.