# Remote MySQL server and Ruby on Rails

**URL:** <https://www.ruby-forum.com/t/remote-mysql-server-and-ruby-on-rails/141230>\
**Category:** Ruby\
**Created:** [June 23, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/remote-mysql-server-and-ruby-on-rails/141230 "2008-06-23T21:30:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 23, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/remote-mysql-server-and-ruby-on-rails/141230/1 "2008-06-23T21:30:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 25, 2008, 9:30am UTC](https://www.ruby-forum.com/t/remote-mysql-server-and-ruby-on-rails/141230/2 "2008-06-25T09:30:24Z")

</div>

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  
.  
cheers,  
kranthi

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 26, 2008, 3:00am UTC](https://www.ruby-forum.com/t/remote-mysql-server-and-ruby-on-rails/141230/3 "2008-06-26T03:00:23Z")

</div>

> 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
