Ruby On Rails:更改数据库用户名和密码

时间:2012-06-08 08:45:35

标签: mysql ruby-on-rails

我不熟悉Ruby on Rails,但我被要求将RoR应用程序从一台服务器移动到另一台服务器。这一切似乎都有效,除了我在log / production.log中获取此日志条目:

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

但是,在我的database.yml文件中,我没有使用root用户。这是它的样子:

 development:
   adapter: mysql2
   encoding: utf8
   reconnect: false
   database: astral
   pool: 5
   username: some_user_name
   password: xyz
   host: 10.0.0.76
   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: astral
   pool: 5
   username: some_user_name
   password: xyz
   socket: /tmp/mysql.sock

 production:
   development

知道我做错了吗?

1 个答案:

答案 0 :(得分:2)

我没有意识到这一点,现在我感到非常愚蠢。然而,也许刚刚开始的人可以通过这个答案为自己节省几分钟的时间。

事实证明,只有在重新启动/重新加载apache服务后才会应用对database.yml文件的更改。现在一切都很好。