Connect mysql in azure from custom database with node.js

I’m trying to connect mysql in azure from custom database section, but get error:

“ER_HANDSHAKE_ERROR: Bad handshake”

It seems that need to set ssl:{} in connection option like below:

var connection = mysql.createConnection({
    host: '',
    port: '3306',
    user: 'user name',
    password: 'password',
    database: 'database  name',
    insecureAuth: true,
    ssl: {
         ca: fs.readFileSync(__dirname + '/certs/cert.pem'),,
        //key: fs.readFileSync(__dirname + '/certs/client-key.pem'),
        //cert: fs.readFileSync(__dirname + '/certs/client-cert.pem')

But, how can I put the pem file into auth0? or any other way to solve this issue?

Hey there!

Sorry for such delay in response! We’re doing our best in providing the best developer support experience out there, but sometimes the number of incoming questions is just too big for our bandwidth. Sorry for such inconvenience!

Do you still require further assistance from us?

To resolve this issue, you may hardcode the certificate by converting it into a string with \n (newline) on the Custom DB script and pass to

You may find a sample for a login script here.

1 Like

Thanks for sharing that knowledge Saltuk!