迁移时出现Rails-mysqldump错误

时间:2017-10-30 04:13:28

标签: mysql ruby-on-rails ruby-on-rails-4 migration

我正在使用Rails 4.0,每次运行迁移时都会收到此错误:

mysqldump: Got error: 1045: Access denied for user 'regan'@'localhost' (using password: NO) when trying to connect
Could not dump the database structure. Make sure `mysqldump` is in your PATH and check the command output for warnings.

我认为迁移仍然正常,但我收到了很多失败的测试(我刚收到这个已经建成的项目)。

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

我假设您没有在database.yml文件中设置用户密码。常见的情况是您在mysql安装中设置了密码,现在却没有提供密码。

您的database.yml文件看起来应该是这样的。

development:
  adapter: mysql2
  encoding: utf8
  database: <my db>
  username: <my user>
  password: <my password>
  host: localhost
  port: 3306
相关问题