2013-06-02 5 views
0

종료하고 처음으로 프로젝트를 설정 유지합니다. WEBrick 서버를 시작할 때마다 부팅되고 종료됩니다. 어떤 도움을 주시면 감사하겠습니다. 암호를 제공해야 할 것 같지만 어떻게해야할지 모르겠습니다.에 WEBrick 서버는 내가 루비와 레일스에 새로 온 사람

bkuethen$ 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/bkuethen/.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/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize' 
    from /Users/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
    from /Users/bkuethen/.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/bkuethen/.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/bkuethen/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' 
    from /Users/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.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/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /Users/bkuethen/Dropbox/Rails Sites/simple_cms/config/environment.rb:5:in `<top (required)>' 
    from /Users/bkuethen/Dropbox/Rails Sites/simple_cms/config.ru:3:in `require' 
    from /Users/bkuethen/Dropbox/Rails Sites/simple_cms/config.ru:3:in `block in <main>' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize' 
    from /Users/bkuethen/Dropbox/Rails Sites/simple_cms/config.ru:in `new' 
    from /Users/bkuethen/Dropbox/Rails Sites/simple_cms/config.ru:in `<main>' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:200:in `app' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:254:in `start' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>' 
    from /Users/bkuethen/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap' 
    from /Users/bkuethen/.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>' 

보석 데이터베이스 파일 설정에

actionmailer (3.2.13) 
actionpack (3.2.13) 
activemodel (3.2.13) 
activerecord (3.2.13) 
activeresource (3.2.13) 
activesupport (3.2.13) 
arel (3.0.2) 
bigdecimal (1.2.0) 
builder (3.0.4) 
bundler (1.3.5) 
coffee-rails (3.2.2) 
coffee-script (2.2.0) 
coffee-script-source (1.6.2) 
erubis (2.7.0) 
execjs (1.4.0) 
hike (1.2.2) 
i18n (0.6.1) 
io-console (0.4.2) 
journey (1.0.4) 
jquery-rails (3.0.0) 
json (1.8.0, 1.7.7) 
mail (2.5.4) 
mime-types (1.23) 
minitest (4.3.2) 
multi_json (1.7.4) 
mysql2 (0.3.11) 
polyglot (0.3.3) 
psych (2.0.0) 
rack (1.4.5) 
rack-cache (1.2) 
rack-ssl (1.3.3) 
rack-test (0.6.2) 
rails (3.2.13) 
railties (3.2.13) 
rake (10.0.4, 0.9.6) 
rdoc (4.0.0, 3.12.2) 
rubygems-bundler (1.1.1) 
rvm (1.11.3.8) 
sass (3.2.9) 
sass-rails (3.2.6) 
sprockets (2.2.2) 
test-unit (2.0.0.0) 
thor (0.18.1) 
tilt (1.4.1) 
treetop (1.4.12) 
tzinfo (0.3.37) 
uglifier (2.1.1) 

UPDATE :

# MySQL. Versions 4.1 and 5.0 are recommended. 
# 
# Install the MYSQL driver 
# gem install mysql2 
# 
# 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: 
    socket: /tmp/mysql.sock 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: simple_cms_test 
    pool: 5 
    username: root 
    password: 
    socket: /tmp/mysql.sock 

production: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: simple_cms_production 
    pool: 5 
    username: root 
    password: 
    socket: /tmp/mysql.sock 

답변

2

이것은 당신의 스택 트레이스의 첫 번째 줄에서 키 정보입니다. 당신은 단순히 여기 database.yml을 해당 루트 암호를 추가해야합니다

development: 
    ... 
    password: MYPASSWORDHERE 
    ... 

파일을 저장하고에 WEBrick를 다시 시작합니다.

MySQL의 루트 암호가 기억 나지 않으면 here과 같이 암호를 재설정해야합니다.

0

서버가 데이터베이스에 액세스하는 문제가있다. config가 맞는지 database.yml을 확인 했습니까?

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

당신은 루트 사용자의 암호가 설정되어 :

+0

터미널에서 데이터베이스에 액세스 해보십시오. – usha

+0

위의 코드를 업데이트하여 데이터베이스 파일을 표시했습니다. 나는 그것이 어떻게 보일 것인지는 잘 모르겠습니다. 그것은 루트를 찾고 있습니다. 나는 터미널을 통해 mysql에 접근 할 수있다. –

+0

터미널에서 암호없이 "mysql -u root"를 사용하여 mysql에 연결할 수 있습니까? – usha