Friday, 12 May 2017

Have Node's mysql package use the .mylogin.cnf file with specific login-path value

I'm using the mysql node package to interact with mysql in a content deployment script.

At the moment I'm creating the connection via the createConnection method like so:

createMysqlConnection () {
    this._db = mysql.createConnection({
        host: config.production.main.mysql.host,
        user: config.production.main.mysql.automator.user,
        password: config.production.main.mysql.automator.password
    })
    this._db.connect()
}

This is working fine.

I know that normally from the command line I can set my login credentials into an encrypted .mylogin.cnf file by using the mysql_config_editor tool that was added in 5.6. I'd like to use this same config file when logging in with the node package so I don't have to store the credentials in an unencrypted config file.

I read through the docs for the package and I'm not seeing any information on how I could tell the package to use the .mylogin.cnf file or to tell it what login-path to use within the file.

Is this possible and, if so, how would I configure the package to do so?



via Chris Schmitz

No comments:

Post a Comment