“ SequelizeConnectionRefusedError:连接ECONNREFUSED 127.0.0.1:3306”此错误不会使我连接到在AWS中创建的数据库实例。我已经在Github存储库的.env文件中更改了数据库配置。
代码如下:
const Sequelize = require("sequelize");
const sequelize = new Sequelize(process.env.DATABASE, process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD, {
host: process.env.DATABASE_HOST,
dialect: 'mysql',
// operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000,
},
});