Project

General

Profile

Redmine2.1.2 startup, Error: Can't connect to MySQL server

Added by baozhong wang about 12 years ago

I have installed redmine 2.1.2.
I have used it for 10 days.
Today, my server restarted. When I startup this service, I got a error.
Mysql service is ok. I have used a tool to connect to mysql server. It's ok.

Pls, help!

D:\redmine-2.1.2>
D:\redmine-2.1.2>ruby script/rails server webrick -e production
=> Booting WEBrick
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting

C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connectio
n_adapters/mysql_adapter.rb:411:in `real_connect': Can't connect to MySQL server
on '192.168.0.8' (10060) (Mysql::Error)
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/mysql_adapter.rb:411:in `connect'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/mysql_adapter.rb:131:in `initialize'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/mysql_adapter.rb:38:in `new'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/mysql_adapter.rb:38:in `mysql_connection'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:309:in `send'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connect
ion'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:241:in `checkout'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:236:in `loop'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:236:in `checkout'
from C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:96:in `connection'
from C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:95:in `connection'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'

from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_specification.rb:170:in `retrieve_co
nnection'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/connection_adapters/abstract/connection_specification.rb:144:in `connection'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/model_schema.rb:308:in `clear_cache!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_rec
ord/railtie.rb:97:in `_callback_before_3'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_su
pport/callbacks.rb:418:in `_run__1002784155__prepare__4__callbacks'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_su
pport/callbacks.rb:405:in `send'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_su
pport/callbacks.rb:405:in `__run_callback'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_su
pport/callbacks.rb:385:in `_run_prepare_callbacks'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_su
pport/callbacks.rb:81:in `send'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_su
pport/callbacks.rb:81:in `run_callbacks'
from C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.2.8/lib/action_dispa
tch/middleware/reloader.rb:74:in `prepare!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.2.8/lib/action_dispa
tch/middleware/reloader.rb:48:in `prepare!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/applicat
ion/finisher.rb:47
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initiali
zable.rb:30:in `instance_exec'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initiali
zable.rb:30:in `run'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initiali
zable.rb:55:in `run_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initiali
zable.rb:54:in `each'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initiali
zable.rb:54:in `run_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/applicat
ion.rb:136:in `initialize!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/
configurable.rb:30:in `send'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/
configurable.rb:30:in `method_missing'
from D:/redmine-2.1.2/config/environment.rb:14
from D:/redmine-2.1.2/config.ru:4:in `require'
from D:/redmine-2.1.2/config.ru:4
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51
:in `instance_eval'
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51
:in `initialize'
from D:/redmine-2.1.2/config.ru:1:in `new'
from D:/redmine-2.1.2/config.ru:1

Replies (1)

RE: Redmine2.1.2 startup, Error: Can't connect to MySQL server - Added by Ivan Cenov about 12 years ago

Are you using IPv6? This was my case on Windows 7. My solution (from stackoverflow) was to replace 'localhost' to the real IPv4 address - in your case '192.168.0.8' - in database.yml:

production:
  adapter: mysql2
  database: redmine
  host: 127.0.0.1         <--------------
  username: redmine
  password: redminepass
  encoding: utf8
    (1-1/1)