Cann't connect to remote mysql server?
Added by Jeff W about 10 years ago
My fresh installation Redmine keeps saying "Can't connect to MySQL server on '192.168.1.103'...", even though mysql client connection is fine and "ruby script/rails server webrick -e production" is also fine. Is there any thing I'm missing? How I can name the environment to 'production' with HTTPD?
database.yml config is below:
-------------------------------
production:
adapter: mysql2
database: redmine
host: 192.168.1.103
username: redmine
password: xxxxxxx
encoding: utf8
port: 3306
\#development:
\# adapter: mysql2
\# database: redmine_development
\# host: localhost
\# username: root
\# password: ""
\# encoding: utf8
Error information:
-------------------------------
Can't connect to MySQL server on '192.168.1.103' (13) (Mysql2::Error)
/usr/local/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `connect'
/usr/local/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `initialize'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/model_schema.rb:224:in `table_exists?'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/primary_key.rb:75:in `get_primary_key'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/primary_key.rb:60:in `reset_primary_key'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/primary_key.rb:49:in `primary_key'
/usr/local/lib/ruby/gems/2.0.0/gems/activerecord-3.2.19/lib/active_record/attribute_assignment.rb:13:in `attributes_protected_by_default'
/usr/local/lib/ruby/gems/2.0.0/gems/activemodel-3.2.19/lib/active_model/mass_assignment_security.rb:216:in `block in protected_attributes_configs'
/usr/local/lib/ruby/gems/2.0.0/gems/activemodel-3.2.19/lib/active_model/mass_assignment_security.rb:188:in `yield'
/usr/local/lib/ruby/gems/2.0.0/gems/activemodel-3.2.19/lib/active_model/mass_assignment_security.rb:188:in `protected_attributes'
/usr/local/lib/ruby/gems/2.0.0/gems/activemodel-3.2.19/lib/active_model/mass_assignment_security.rb:118:in `block in attr_protected'
/usr/local/lib/ruby/gems/2.0.0/gems/activemodel-3.2.19/lib/active_model/mass_assignment_security.rb:117:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/activemodel-3.2.19/lib/active_model/mass_assignment_security.rb:117:in `attr_protected'
/var/www/redmine/app/models/issue_relation.rb:73:in `<class:IssueRelation>'
/var/www/redmine/app/models/issue_relation.rb:18:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:359:in `require_or_load'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:502:in `load_missing_constant'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:192:in `block in const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:514:in `load_missing_constant'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:192:in `block in const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:514:in `load_missing_constant'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:192:in `block in const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:514:in `load_missing_constant'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:192:in `block in const_missing'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:190:in `const_missing'
/var/www/redmine/lib/redmine/helpers/gantt.rb:28:in `<class:Gantt>'
/var/www/redmine/lib/redmine/helpers/gantt.rb:21:in `<module:Helpers>'
/var/www/redmine/lib/redmine/helpers/gantt.rb:19:in `<module:Redmine>'
/var/www/redmine/lib/redmine/helpers/gantt.rb:18:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/var/www/redmine/lib/redmine.rb:56:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/var/www/redmine/config/initializers/30-redmine.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:245:in `load'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:245:in `block in load'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/lib/ruby/gems/2.0.0/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:245:in `load'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/engine.rb:592:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/engine.rb:592:in `block in <class:Engine>'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `run'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/application.rb:136:in `initialize!'
/usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/redmine/config/environment.rb:14:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/usr/local/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
/usr/local/lib/ruby/gems/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/helper-scripts/rack-preloader.rb:112:in `eval'
/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/helper-scripts/rack-preloader.rb:112:in `preload_app'
/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/helper-scripts/rack-preloader.rb:28:in `<main>'
Replies (1)
RE: Cann't connect to remote mysql server? - Added by Jeff W about 10 years ago
All right, I figured it out, SELinux was the bad guy!