0

I am using azure connection string (from Azure portal) for Node.js app, still cannot connect to Azure Database for Mysql server.

var conn = mysql.createConnection({ host: yourhost, user: "username", password: "password", database: "database", port: 3306, ssl:{ca:fs.readFileSync(__dirname + '/baltimore.pem')}});

I get following error: "Error: MySQL server is requesting the old and insecure pre-4.1 auth mechanism.Upgrade the user password or use the {insecureAuth: true} option."

But I can connect using Mysql Benchmark same credentials.

What I am doing wrong ?

1 Answer 1

0

Azure Database for MySQL is incompatible with the mysqljs connector library. See issue 1729 for details and pull 1730 for a workaround.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for an answer, now it gives an error : \lib\protocol\Parser.js:80 throw err; // Rethrow non-MySQL errors ^ Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:344:11)
@RuslanSafarov That looks like an error with whatever HTTP library you are using; once the HTTP headers have been sent to the client, they can't be modified.
I am using standart http and Express. I was using createPool, now when I use createConnection i get another error : The solution is: undefined events.js:141 throw er; // Unhandled 'error' event ^ Error: read ECONNRESET at exports._errnoException (util.js:873:11) at TLSWrap.onread (net.js:557:26)
Anyway thanks for an answer :) I guess I am missing something, I will accept answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.