sequelize连接mssql报错

const db = require(‘sequelize’)
const connetdb = new db(‘cgclcc’, ‘sa’, ‘123’, {
host: ‘127.0.0.1’,
dialect:’mssql’,
});
async function q1(){
try {
await connetdb.authenticate();
console.log(‘Connection has been established successfully.’);
} catch (error) {
console.error( error);
}

}
q1()

报错信息如下:报错信息

讨论数量: 1

You get the same error if you use options.encrypt: true on Node v12+ with old SQL Server versions. This is caused by Node v12 requiring TLS 1.2. There is nothing tedious could do about it, so you got 3 options:

  • install the TLS 1.2 security patch for your SQL Server
  • run node with backwards compatibility flag: node --tls-min-v1.0
  • disable encrypted communication by setting options.encrypt: false
3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!