Connecting from Node.js to MySQL managed database

Posted October 15, 2019 5.1k views
DigitalOcean Managed MySQL Database


We are trying to connect the MySQL managed database cluster from Node.js app, and DB configuration as follows,

export const databaseConfig: DatabaseConfig = {
    username: 'doadmin',
    password: 'xxxxxxxxx',
    database: 'xxxxxxxxx',
    host: '',
    port: 25060,
    dialect: 'mysql',
    logging: true,
    force: true,
    timezone: '+00:00',
    pool: {
        max: 100,
        min: 0,
        idle: 200000,
        acquire: 1000000,
    ssl: true,
    dialectOptions: {
        ssl: {
            ssl: true,
            cert: fs.readFileSync(process.env.INIT_CWD + '/server/config/' + 'glitra_mysql_ca-certificate.crt')

The .crt file is downloaded from DO database connection setting section, When we run the application we are getting “self signed certificate in certificate chain”.

Anybody tried connecting with from Nodejs to managed db and help us on this issue?


edited by MattIPv4
  • Hi there @aalurdratek,

    Could you just confirm that you’ve placed the .crt file that you downloaded from DigitalOcean in the correct location, wherever process.env.INIT_CWD + '/server/config/' + 'glitra_mysql_ca-certificate.crt' resolves to?

  • Hi,

    I have the same issue. No success. Could you please tell me if you were able to find the solution?

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!