Webrick Rails Server无法正常运行

时间:2013-04-18 03:01:36

标签: ruby-on-rails webrick mysql2

我花了最后6个小时修复问题,例如修改$ PATH,安装Gems以最终得到应有的一切。 但是在我用它的组件创建项目文件夹并尝试运行服务器之后,我得到了这样的消息: -

\KAMAL$ ls
Gemfile     README.rdoc app     config.ru   doc     log     script      tmp
Gemfile.lock    Rakefile    config      db      lib     public      test        vendor
\KAMAL$ 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
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Access denied for user 'root'@'localhost' (using password: NO) (Mysql2::Error)
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'

“和上面的许多行一样”

宝石清单 *本地宝石*

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)
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)
journey (1.0.4)
jquery-rails (2.2.1)
json (1.7.7)
mail (2.5.3)
mime-types (1.22)
multi_json (1.7.2)
mysql2 (0.3.11)
polyglot (0.3.3)
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)
rdoc (3.12.2)
rubygems-update (2.0.3)
sass (3.2.7)
sass-rails (3.2.6)
sprockets (2.2.2)
thor (0.18.1)
tilt (1.3.7)
treetop (1.4.12)
tzinfo (0.3.37)
uglifier (2.0.1)
webrick (1.3.1) 

请帮助

1 个答案:

答案 0 :(得分:2)

此日志条目

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

显示您在localhost上使用root用户而没有密码作为数据库。 MySQL不认为这是一个有效的用户。以下行应发出相同的错误消息:

mysql -u root -h localhost

请检查db/database.yml文件

中的数据库用户/密码