sequelize没有连接到MySql

时间:2014-04-16 15:35:30

标签: 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.  

Config.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"
}

我可以通过

轻松连接到db
mysql --host=localhost --user=imvgm_dev --password=imvgm_dev imvgm_development

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我认为您需要在config.js中添加“port”。 而且您无需在命令行中指定config.js.这应该有效:

# sequelize -m