无法将Azure Web App-NodeJS连接到Azure Mysql

问题描述:

我正在使用Azure连接字符串(来自Azure门户)用于Node.js应用程序,但仍无法连接到Mysql服务器的Azure数据库.

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({ 主持人:yourhost, 用户:用户名", 密码:密码", 数据库:数据库", 端口:3306, ssl:{ca:fs.readFileSync(__ dirname +'/baltimore.pem')}});

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

我收到以下错误: 错误:MySQL服务器正在请求旧的且不安全的4.1之前的身份验证机制.升级用户密码或使用{insecureAuth:true}选项."

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."

但是我可以使用Mysql Benchmark相同的凭据进行连接.

But I can connect using Mysql Benchmark same credentials.

我做错了什么?

Azure MySQL数据库与 mysqljs不兼容连接器库.有关详细信息,请参见问题1729

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