【发布时间】:2016-12-31 15:40:00
【问题描述】:
我正在尝试创建一个数据库并将其与我的 rails 应用程序连接。
当我尝试检查我的数据库是否通过以下方式正确连接时:
rails db:schema:dump
它给了我 ff 错误:
Mysql2::Error: Access denied for user 'rails_user'@'localhost' (using password:
YES)
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:schema:dump
(See full trace by running task with --trace)
这让我大吃一惊,因为我在创建数据库时使用了确切的密码:
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: rails_user
password: grace0512
host: localhost
development:
<<: *default
database: test_project_development
# 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:
<<: *default
database: test_project_test
我确实试过这个:
grant all on simple_cms_development.* to 'rails_user'@'localhost' identified by '<password>';
flush privileges;
但没有解决我的问题。请问有什么帮助吗?
我真的需要解决这个问题才能继续前进!
【问题讨论】:
-
我知道这是一个很长的镜头,但请确保
password: grace0512之后没有空格 .. 可以肯定的是,将所有值包含在""中。password: "grace0512" -
对我不起作用。
标签: ruby-on-rails mysql2