0

Hey I can't figure out what to do to fix this error message. Just started with ruby with rails and trying to get it all set up so I can learn more but and stuck on trying to get WEBrick to work. Anything will help, THANKS!

 C:\Users\Brandon\Documents\Sites\simple_cms>rails server
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/connec
tion_adapters/mysql_adapter.rb:411:in `real_connect': Can't connect to MySQL ser
ver on 'localhost' (10061) (Mysql::Error)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/mysql_adapter.rb:411:in `connect'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/mysql_adapter.rb:131:in `initialize'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/mysql_adapter.rb:38:in `new'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/mysql_adapter.rb:38:in `mysql_connection'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_ 
record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_conn
ection'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels)
in checkout'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout
'
    from C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_ 
record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:102:in `block in connecti
on'
    from C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connecti   
on'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve
_connection'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/connection_adapters/abstract/connection_specification.rb:145:in `connecti
on'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_
record/railtie.rb:88:in `block in <class:Railtie>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initi
alizable.rb:30:in `instance_exec'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initi
alizable.rb:30:in `run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initi
alizable.rb:55:in `block in run_initializers'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initi
alizable.rb:54:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initi
alizable.rb:54:in `run_initializers'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/appli
cation.rb:136:in `initialize!'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/railt
ie/configurable.rb:30:in `method_missing'
    from C:/Users/Brandon/Documents/Sites/simple_cms/config/environment.rb:5
:in `<top (required)>'
    from C:/Users/Brandon/Documents/Sites/simple_cms/config.ru:3:in `require
'
    from C:/Users/Brandon/Documents/Sites/simple_cms/config.ru:3:in `block i
n <main>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:
51:in `instance_eval'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:
51:in `initialize'
    from C:/Users/Brandon/Documents/Sites/simple_cms/config.ru:in `new'
    from C:/Users/Brandon/Documents/Sites/simple_cms/config.ru:in `<main>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:
40:in `eval'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:
40:in `parse_file'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:2
00:in `app'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/comma
nds/server.rb:46:in `app'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:3
04:in `wrapped_app'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:2
54:in `start'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/comma
nds/server.rb:70:in `start'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/comma
nds.rb:55:in `block in <top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/comma
nds.rb:50:in `tap'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/comma
nds.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I am trying some different things to make this work and I seen someone said it could be a problem with not having a gemfile opensll or something and then I read another thing where it said to try rake db:create and I got this error message also.

C:\Users\Brandon\Documents\Sites\simple_cms>rake db:create
Can't connect to MySQL server on 'localhost' (10061)
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnec
t"=>false, "database"=>"simple_cms_development", "pool"=>5, "username"=>"root",
"password"=>nil, "host"=>"localhost"}, charset: utf8, collation: utf8_unicode_ci

(if you set the charset manually, make sure you have a matching collation)
Can't connect to MySQL server on 'localhost' (10061)
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnec
t"=>false, "database"=>"simple_cms_test", "pool"=>5, "username"=>"root", "passwo
rd"=>nil, "host"=>"localhost"}, charset: utf8, collation: utf8_unicode_ci
(if you set the charset manually, make sure you have a matching collation)
BTG
  • 1
  • 3

2 Answers2

0

It looks like whatever configuration information in config/database.yml is invalid or you haven't configured your MySQL server correctly.

From the error you're receiving it looks like your MySQL server isn't running, or isn't responding on the port you've defined.

Test that you can connect with the mysql command-line tool or something equivalent.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • I'am still confused as of what I should do? Forgive my stupidity – BTG Apr 18 '13 at 02:12
  • This is a classic case of "is it plugged in", by which I mean, is your MySQL server running? Do you even have one installed? If so, can you verify that you can connect to it with the credentials you've put in `config/database.yml`? – tadman Apr 18 '13 at 02:55
  • # Ensure the MySQL gem is defined in your Gemfile # gem 'mysql2' # # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: adapter: mysql2 encoding: utf8 reconnect: false database: simple_cms_development pool: 5 username: root password: host: 127.0.0.1 – BTG Apr 18 '13 at 03:32
  • I mean is your local `mysql` server process running? – tadman Apr 18 '13 at 03:45
  • Look at your process listing. Is it there? – tadman Apr 18 '13 at 03:48
  • I am very new to this, I don't understand what that means – BTG Apr 18 '13 at 03:49
  • Maybe you need to install MySQL Server. – tadman Apr 18 '13 at 05:02
0

You need to install mysql for Windows Here. Mysql is a not part of the Ruby environment and it is not handled with Bundler and/or Rails. Do you have an instance of mysql installed on your computer?

John
  • 1,530
  • 1
  • 10
  • 19
  • yeah I have it installed, like i can access the MySQL command line for 5.6 and everything. Did I possibly install it wrong? – BTG Apr 18 '13 at 04:51
  • can you log into the mysql via command line? Not just access the mysql command. Do mysql -u . When it asks you for the password use the same you are trying to use in your config/database.yml. Looking at your error the user is root and the password is nil. Does your root user not have a password? – John Apr 18 '13 at 05:34