Remote MySQL server and Ruby on Rails

W

wedix

Hello,

I have 1 DB server (MySQL) and 1 server with my application. I've
setup the host in my database.yml file to match my DB server. When I
run the application, I get this error:

Errno::ENOENT in TestController#index
No such file or directory - /tmp/mysql.sock

--- Full Trace ---
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
vendor/mysql.rb:107:in `initialize'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
vendor/mysql.rb:107:in `new'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
vendor/mysql.rb:107:in `real_connect'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/mysql_adapter.rb:505:in `connect'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/mysql_adapter.rb:183:in `initialize'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/mysql_adapter.rb:88:in `new'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/mysql_adapter.rb:88:in `mysql_connection'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/abstract/connection_specification.rb:292:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/abstract/connection_specification.rb:292:in
`connection='
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/abstract/connection_specification.rb:260:in
`retrieve_connection'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/abstract/connection_specification.rb:78:in
`connection'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
query_cache.rb:8:in `cache'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/caching/sql_cache.rb:12:in `perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:529:in `send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:529:in `process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/filters.rb:569:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/session_management.rb:130:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:389:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:149:in `handle_request'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:107:in `dispatch'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:104:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:120:in `dispatch_cgi'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:35:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
103:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
153:in `with_signal_handler'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
101:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
78:in `process_each_request'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
77:in `process_each_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
76:in `catch'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
76:in `process_each_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
50:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
24:in `process!'
/path/to/my/public_html/public/dispatch.fcgi:26
--- ---

--- database.yml ---
development:
adapter: mysql
encoding: utf8
database: Test_App_development
username: root
password:
host: dbserver

test:
adapter: mysql
encoding: utf8
database: Test_App_test
username: root
password:
host: dbserver

production:
adapter: mysql
encoding: utf8
database: Test_App_production
username: root
password:
host: dbserver
--- ---

The MySQL gem is installed. I'm not sure what's wrong...

Any help is appreciated!

Thank you,


- wedix
 
K

kranthi reddy

[Note: parts of this message were removed to make it a legal post.]

I think the socket on which your remote server is different from
/tmp/mysql.sock.
Just check with the socket and then place the same thing on the database.yml
 
R

Roger Pack

production:
adapter: mysql
encoding: utf8
database: Test_App_production
username: root
password:
host: dbserver

You may need to specify a port number, and/or protocol: tcp. GL!
-R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top