hedgehog lab

Sarat Pediredla

Easing MySQL pain when using Locomotive and XAMPP

by Sarat Pediredla

If you are one of those n00bs that are looking to learn Ruby on Rails on a Mac OS X and happen to use the unfortunate combination of Locomotive and a XAMPP-based MySQL server, you will probably be frustrated with the following error,

           Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

The secret sauce to solve this problem is to connect to your MySQL using an IP address (to force TCP/IP) rather than the default socket-based connection initiated by using localhost.

Simply change the following line in your Rails config/database.yml from,

  host: localhost

to

  host: 127.0.0.1

blog comments powered by Disqus