So I am developing locally using Rails 3.2 and mysql. My local machine is a Mac and my database.yml for development is:
development: adapter: mysql2 database: dbname encoding: utf8 host: localhost port: 3306 timeout: 5000 socket: /tmp/mysql.sock
And for test it's
test: adapter: mysql2 database: dbname encoding: utf8 host: localhost port: 3306 timeout: 5000 socket: /var/lib/mysql/mysql.sock
Test and production servers are on CentOS and the socket works correctly when deploying to them. However I just went to do a manual rake and got the
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
My site works, but I'm curious if I'm should be handling database.yml separately for deployment since it's somehow looking at development when I run rake?
Looked for a suggestion and didn't see the same issue, apologize in advance if I missed it.
You can specify the Rails environment when you run the Rake task.
rake db:migrate RAILS_ENV=production
I can think of three alternatives:
sharedfolder to handle different database.yml
.zshrcor whatever you use for your shell - Pedro Nascimento 2012-04-04 17:07