跑步
sequelize db:migrate
打印出来:
Sequelize [Node: 6.9.4, CLI: 2.4.0, ORM: 3.24.6]
Loaded configuration file "config\development.json".
Unable to connect to database: SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306
然后看看 config/development.json 我看到:
{
"development": {
"username": "postgres",
"password": "password",
"database": "mydb",
"host": "127.0.0.1",
"port": "5432",
"dialect": "postgres"
},
"test": {
"username": "postgres",
"password": "password",
"database": "mydb",
"host": "127.0.0.1",
"port": "5432",
"dialect": "postgres"
},
"production": {
"username": "postgres",
"password": "password",
"database": "mydb",
"host": "127.0.0.1",
"port": "5432",
"dialect": "postgres"
}
}
为什么?为什么sequelize还在尝试去mysql端口?正如您在配置文件中看到的那样,我还添加了端口。我找不到任何资源说不支持 postgres。但似乎 sequelize-cli 仍然不关心方言甚至我在配置文件中输入的端口号。