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/