Project

General

Profile

Actions

Defect #2808

closed

Can't connect to a remote MySQL server

Added by Simon van der Linden almost 16 years ago. Updated almost 16 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-02-23
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

My webserver is not the same as my SQL server, so I configured my database.yml file as follows:

production:
  adapter: mysql
  database: redmine
  username: redmine
  password: *****
  encoding: utf8
  host: storage

Note: storage is a resolvable hostname on the webserver.

But then, when I try to load a page, I get the following error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:527:in `real_connect'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:527:in `connect'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:186:in `initialize'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:85:in `new'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:85:in `mysql_connection'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in `send'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in `connection='
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in `retrieve_connection'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/query_cache.rb:8:in `cache'
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:in `send'
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/session_management.rb:130:in `process'
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:389:in `process'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:103:in `process_request'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:153:in `with_signal_handler'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:101:in `process_request'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:78:in `process_each_request'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:77:in `process_each_request'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:76:in `catch'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:76:in `process_each_request'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:50:in `process!'
/var/lib/gems/1.8/gems/rails-2.1.2/lib/fcgi_handler.rb:24:in `process!'

Honestly, I don't know anything about Rails, so maybe it is not the right place to report such a problem. Any help would be appreciated.

Actions #1

Updated by A. Ni. almost 16 years ago

Hi Simon,

please look at this: http://rubyresponse.wordpress.com/2006/07/22/cant-find-mysqldsock/

This helped me a while ago.

Cheers,
A.

Actions #2

Updated by Simon van der Linden almost 16 years ago

As I stated in the issue description, my MySQL server is not running on the same machine as the webserver. There is thus no socket to look for!

Thanks for your attention, anyway.

Actions #3

Updated by Jean-Baptiste Barth almost 16 years ago

Did you try with a fully qualified domain name ?
Did you try to connect on this server/db with just the "mysql" command (i.e. outside a rails app) ?

Actions #4

Updated by Simon van der Linden almost 16 years ago

Jean-Baptiste Barth wrote:

Did you try with a fully qualified domain name ?

Yes, I did. Even with an IP address, it doesn't work.

Did you try to connect on this server/db with just the "mysql" command (i.e. outside a rails app) ?

Yes, I did. It works.

Actions #5

Updated by Jean-Philippe Lang almost 16 years ago

How do you run/start Redmine ?

Actions #6

Updated by Simon van der Linden almost 16 years ago

Jean-Philippe Lang wrote:

How do you run/start Redmine ?

With the command given on the RedmineInstall wiki page:

# ruby script/server -e production
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
server: invalid option: -e
=> Rails 2.1.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
checking plugin 'engines' for 'application_helper'
[...]
loading from application: application_helper
loading routes from /var/www/projects.vanderlinden.eu.org/vendor/plugins/engines/routes.rb
[...]

Haha, pebcak: I didn't notice the invalid option warning.

However, I don't see any option that would set the environment:

# ruby script/server --help
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
Usage: server [options]
    -p, --port=port                  Changes the server.port number in the config/lighttpd.conf
    -c=[...]/config/lighttpd.conf
        --config                     Specify a different lighttpd config file.
    -h, --help                       Show this message.
    -d                               Call with -d to detac

Actions #7

Updated by Jean-Philippe Lang almost 16 years ago

-e is a webrick option. Read the doc of lighttpd to see how to run it in production mode.

But you can try this for now:

ruby script/server webrick -e production
Actions #8

Updated by Simon van der Linden almost 16 years ago

  • Status changed from New to Resolved

Good, it works. Shall I update the wiki page accordingly?

Actions #9

Updated by Jean-Philippe Lang almost 16 years ago

  • Status changed from Resolved to Closed
  • Affected version (unused) deleted (0.8.0)
  • Resolution set to Invalid

Done.

Actions

Also available in: Atom PDF