node.js - Sequelize 无法连接到 MySql

标签 node.js ubuntu orm sequelize.js

Sequlize 在应用迁移时抛出错误。

# sequelize --config config/config.js -m
Loaded configuration file "config/config.js".
Loaded configuration file "config/config.js".
Unable to connect to database: Error: Failed to authenticate for MySQL. Please double check your settings.  

配置.js

"db": {
"development": {
  "username": "imvgm_dev",
  "password": "imvgm_dev",
  "database": "imvgm_development",
  "host": "localhost"
},
"production": {
  "username": "imvgm_production",
  "password": "imvgm_production",
  "database": "imvgm_production",
  "host": "localhost"
},
"testing": {
  "username": "imvgm_testing",
  "password": "imvgm_testing",
  "database": "imvgm_testing",
  "host": "localhost"
}

我可以通过

轻松连接到数据库
mysql --host=localhost --user=imvgm_dev --password=imvgm_dev imvgm_development

有什么想法吗?

最佳答案

我认为您需要将“端口”添加到您的 config.js 中。 并且不需要在命令行中指定config.js。这应该有效:

# sequelize -m

关于node.js - Sequelize 无法连接到 MySql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23113965/

相关文章:

javascript - 处理大型 JSON 文件的最佳实践

node.js - 用于 pretty-print HTML 的模块?

rest - channel :mychannel received discovery error:access denied Failed to evaluate transaction: Error: DiscoveryService: mychannel error: access denied

Python SQLAlchemy - 外键错误

java - JPA/hibernate : What use is an ORM (Hibernate) when it doesn't get all JPA mappings right?

java - 在 Hibernate 中映射多级继承

angularjs - 需要等待 heroku-connect SFID

node.js - 在 Express 应用程序的模型中创建 MySql 架构

mysql - 在亚马逊上; Ubuntu;无法使用 crontab 重启 mysql

bash - 计算文本文件中的回文数