我已经在两个不同的js文件中初始化了下面的代码,即users.js和customers.js
//sequelize
var sequelize = new Sequelize(process.env.DATABASE_STAGING, process.env.USER_STAGING, process.env.PASSWORD_STAGING, {
host: process.env.HOST_STAGING,
dialect: 'mysql',
logging: false
});
sequelize
.authenticate()
.then(() => {
console.log('Connection has been established successfully.');
})
.catch(err => {
console.error('Unable to connect to the database:', err);
});
我不确定这是否会导致我无法解决的错误:
Unhandled rejection SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MySQL client
如何在一个文件中分隔Sequelize初始化并在另一个文件中使用它?