Trouble starting rails server Webrick
Asked Answered
G

1

1

Just starting to get into RoR development and I am struggling with getting the Webrick server to start. I am in my rails project's folder. Then I enter rails server or rails s and it looks like the server is going to start then it says Exiting with a bunch of other stuff listed below it. Anyone know what is wrong?? Here is what terminal spits out...

wyep:simple_cms designer1$ rails s
=> 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
/Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Access denied for user 'root'@'localhost' (using password: NO) (Mysql2::Error)
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /Users/designer1/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout' from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /Users/designer1/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Applications/MAMP/htdocs/simple_cms/config/environment.rb:5:in `<top (required)>'
from /Applications/MAMP/htdocs/simple_cms/config.ru:3:in `require'
from /Applications/MAMP/htdocs/simple_cms/config.ru:3:in `block in <main>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Applications/MAMP/htdocs/simple_cms/config.ru:in `new'
from /Applications/MAMP/htdocs/simple_cms/config.ru:in `<main>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Guillemot answered 7/6, 2013 at 20:17 Comment(0)
R
1

Error is in the message there:

Access denied for user 'root'@'localhost' (using password: NO) (Mysql2::Error)

In your config/database.yml you need to specify a valid host, user and password

Roswald answered 7/6, 2013 at 20:18 Comment(3)
Ok I'm in there and I do not see a line for "host:" Is it not that obvious?Guillemot
By default, it is not there and defaults to localhost. If you want to connect to a different server, you will need to put in host: <YOUR_HOST_HERE>Roswald
see if you can connect to mysql from the console using the command mysql -u root without passwordParaguay

© 2022 - 2024 — McMap. All rights reserved.