1

我是 Ruby on Rails 的新手,很抱歉这个问题,这可能很容易,但是..

所以,这是我的问题:我有带有 RoR 的 Ubuntu 12.04。我正在参与一些项目,所以我检查了 svn,安装了 bundle,现在我遇到了 rails 服务器的问题。这是来自终端的日志

    public 不再用于避免重载 Module#public,而是使用 :public_folder
    来自 /usr/lib/ruby/gems/1.8/gems/web_translate_it-1.7.1.3/lib/web_translate_it/server.rb:12
    弃用警告: require "activerecord" 已被弃用,将在 Rails 3 中删除。请改用 require "active_record"。(从 /usr/lib/ruby/vendor_ruby/activerecord.rb:2 调用)
    => 启动 WEBrick
    => Rails 3.2.12 应用程序开始在 http://0.0.0.0:3000 开发
    => 使用 -d 调用以分离
    => Ctrl-C 关闭服务器
    退出
    /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': 拒绝用户 'fubademoall'@'localhost' 访问(使用密码:YES ) (Mysql2::错误)
        来自 /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `send'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `checkout'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `checkout'
        来自 /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in 'connection'
        来自 /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in 'connection'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:308:in `clear_cache!'
        来自 /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/railtie.rb:97:in `_callback_before_3'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:418:in `_run__1552657550__prepare__4__callbacks'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `send'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `send'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
        来自 /usr/lib/ruby/gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
        来自 /usr/lib/ruby/gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/application/finisher.rb:47
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `run_initializers'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `send'
        来自 /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
        来自 /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'

谢谢指教!

4

3 回答 3

3

连接 MySQL 数据库时出错:

/usr/lib/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': 拒绝用户 'fubademoall'@'localhost' 访问(使用密码:YES ) (Mysql2::错误)

检查config/database.yml中的配置是否与您正在使用的 MySQL 服务器上的数据库凭据匹配。

于 2013-04-09T09:05:27.210 回答
1
If you are new Please see following eg: for creating database, grant ,and database.yml file  

=> Go to Mysql :
D:\sandeep\Ruby Projects\simple_cms>mysql -u root -p
Enter password: ********

=>Create Database :
 create database simple_cms_development 

=>Gtanting the Access to database : 
 mysql> grant all privileges on simple_cms_development.*
     ->to 'simple_cms' @'localhost'
     -> identified by 'secretpassword';
Query OK, 0 rows affected (0.00 sec)

=>See Database and Grant :
 mysql> show grants for 'simple_cms' @'localhost';

=>And Your database.yml file like this :
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: simple_cms_development
  pool: 5
  username: simple_cms
  password: secretpassword
  socket: /tmp/mysql.sock

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
于 2013-04-09T09:37:36.513 回答
0

我认为错误消息的相关行是:

`connect': Access denied for user 'fubademoall'@'localhost' (using password: YES) (Mysql2::Error)

你设置mysql了吗?权限是否正确?

于 2013-04-09T09:08:00.723 回答