Rails Database Configuration on Fedora Core
Jun 27
A few days ago I was testing a Rails app on Fedora Core and ran into a slight problem. You could actually call it a major problem since I was unable to talk to MySQL and instantiate any model objects. Sometimes serious problems seem a little less serious when the fix is pretty straight-forward. Lucky for me this was the case this time around. When I started the application and tried to access my test controller I received the following error message:
Errno::ENOENT in TestController#index
No such file or directory – /tmp/mysql.sock
By default Rails looks for the mysql.sock in the tmp directory. Since I used the default MySQL installation on Fedora this file was located in another directory. I found the path to the file to be located at /var/lib/mysql/mysql.sock. I updated the database.yml config file to include the proper location:
socket: /var/lib/mysql/mysql.sock
and everything started running perfectly. A somewhat simple fix for a somewhat serious problem.
