我无法使用sequelize连接到mysql

时间:2019-11-02 21:53:35

标签: mysql node.js database sequelize.js digital-ocean

我无法通过sequelize连接到mysql, 我无法与mysql服务器建立连接(mysql版本为8)。

给了我这个错误,即使在互联网上看也无法解决。 我正在使用digitalocean提供的mysql数据库

const Sequelize = require('sequelize');
const fs = require('fs')


const sequelize = new Sequelize('defaultdb','user','pass',
{
    dialect : 'mysql',
    port : '25060',
    host: 'db-mysql-fra1-insquare-do-user-6497882-0.db.ondigitalocean.com',
    dialectOptions: {
        ca   : 'fs.readFileSync("ca-certificate.crt").toString()'
    }

}
);


module.exports = sequelize;

Connession al DB Error: { SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Promise.tap.then.catch.err (/root/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:133:19)
    at tryCatcher (/root/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/node_modules/bluebird/js/release/promise.js:517:31)
    at Promise._settlePromise (/root/node_modules/bluebird/js/release/promise.js:574:18)
    at Promise._settlePromise0 (/root/node_modules/bluebird/js/release/promise.js:619:10)
    at Promise._settlePromises (/root/node_modules/bluebird/js/release/promise.js:695:18)
    at _drainQueueStep (/root/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/root/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/root/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/root/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)

0 个答案:

没有答案