question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connecting to Azure Database for MySQL fails

See original GitHub issue

Create an Azure Database for MySQL 5.7 instance and attempt to connect to it. The following exception is thrown:

Error: MySQL server is requesting the old and insecure pre-4.1 auth mechanism.Upgrade the user password or use the {insecureAuth: true} option.
    at Handshake.UseOldPasswordPacket (F:\mysql\lib\protocol\sequences\Handshake.js:85:15)
    at Protocol._parsePacket (F:\mysql\lib\protocol\Protocol.js:280:23)
    at Parser.write (F:\mysql\lib\protocol\Parser.js:76:12)
    at Protocol.write (F:\mysql\lib\protocol\Protocol.js:39:16)
    at Socket.<anonymous> (F:\mysql\lib\Connection.js:103:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)
    --------------------
    at Protocol._enqueue (F:\mysql\lib\protocol\Protocol.js:141:48)
    at Protocol.handshake (F:\mysql\lib\protocol\Protocol.js:52:41)
    at Connection.connect (F:\mysql\lib\Connection.js:130:18)
    at Object.<anonymous> (F:\Code\Projects\azure-mysql\index.js:9:12)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

I believe this is the same problem as mysql-net/MySqlConnector#259 with a spurious error message due to Handshake.js assuming all packets starting with 0xFE are requesting old auth.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bgraingercommented, May 25, 2017

@dbalaouras I authored a workaround in e3e123e9af7c0829a6c1417d911572a75b4a5f95 (but it hasn’t been merged in yet). I suppose you might be able to cherry-pick that fix to a local copy of the code (and/or use npm link)?

The only other workaround I can think of would be a custom MySQL proxy that sits between this code and Azure Database for MySQL, and handles the authentication correctly; that would be a rather complex project though. This wouldn’t work unless it knew your original password.

Other than that, based on what I know about Azure MySQL and mysqljs, I can’t think of an easy workaround.

0reactions
dbalaourascommented, May 25, 2017

@bgrainger many thanks for the followup. I need to use the original version of Ghost, hence I cannot modify it’s codebase. I guess I have to wait for your patch to get pulled, or Azure to support fast path authentication…in the meanwhile I’m dropping Azure Mysql.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Investigating connection issues with Azure Database for MySQL
Connection string or password · Be sure that the "username" exists as a valid user on the server, as it may have been...
Read more >
Troubleshoot connectivity issues in Azure Database for MySQL
The connection was established, but it was lost afterwards. This can happen if a connection is attempted against something that isn't MySQL ( ......
Read more >
Troubleshoot connection issues - Azure Database for MySQL
If the application persistently fails to connect to Azure Database for MySQL Flexible Server, it usually indicates an issue with one of the ......
Read more >
Troubleshoot common errors - Azure Database for MySQL
Learn how to troubleshoot common migration errors encountered by users new to the Azure Database for MySQL service.
Read more >
Transient connectivity errors - Azure Database for MySQL
A transient error, also known as a transient fault, is an error that will resolve itself. Most typically these errors manifest as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found