Configure mysql over tls/ssl

Thanks vikasptluri123 just what I needed.

I have been able to configure ssl/tls to mysql.

If anyone else wants to configure ssl/tls to mysql in the future please see these 2 pages mysql - npm and TLS (SSL) | Node.js v19.4.0 Documentation for options available.

2 example configs I have been playing with (I haven’t configured it based on key yet)
Simple
“database”: {
“client”: “mysql”,
“connection”: {
“host”: “127.0.0.1”,
“user”: “user”,
“password”: “pass”,
“database”: “ghostdb”,
“ssl”: {}
}
}

Setting TLS1.2 as the version to use
“database”: {
“client”: “mysql”,
“connection”: {
“host”: “127.0.0.1”,
“user”: “user”,
“password”: “pass”,
“database”: “ghostdb”,
“ssl”: {
“rejectUnauthorized”: “true”,
“secureProtocol”: “TLSv1_2_method”
}
}
}

1 Like