Description
Hey there!
I've found what it seems to be a strange bug in the authentication with the database. Whenever the database server is restarted, I am getting an access denied error like this one:
error: Uncaught (in promise) Error: Access denied for user 'my_username'@'127.0.0.1' (using password: YES)
at Packet.asError (file:///home/my_username/.cache/deno/npm/registry.npmjs.org/mysql2/3.9.7/lib/packets/packet.js:728:17)
at ClientHandshake.execute (file:///home/my_username/.cache/deno/npm/registry.npmjs.org/mysql2/3.9.7/lib/commands/command.js:29:26)
at Connection.handlePacket (file:///home/my_username/.cache/deno/npm/registry.npmjs.org/mysql2/3.9.7/lib/connection.js:481:34)
at PacketParser.onPacket (file:///home/my_username/.cache/deno/npm/registry.npmjs.org/mysql2/3.9.7/lib/connection.js:97:12)
at PacketParser.executeStart (file:///home/my_username/.cache/deno/npm/registry.npmjs.org/mysql2/3.9.7/lib/packet_parser.js:75:16)
at Socket.<anonymous> (file:///home/my_username/.cache/deno/npm/registry.npmjs.org/mysql2/3.9.7/lib/connection.js:104:25)
at Socket.emit (ext:deno_node/_stream.mjs:1851:9)
at addChunk (ext:deno_node/_stream.mjs:2873:16)
at readableAddChunk (ext:deno_node/_stream.mjs:2852:13)
at Socket.Readable.push (ext:deno_node/_stream.mjs:2791:14)
The user has the permissions to login from anywhere ('%') and is using the new caching_sha2_password
, as I was tired of the deprecation warnings logs in the database about the mysql_native_password
plugin.
My workarround at this moment is the most weird part. If I login to the database with the same credentials using the mysql CLI, I got not error at all, and afterwards the application can also login without getting any more errors until the next database restart.
I've been researching a lot in the last day about this issue but can't find any answer or permanent solution. Anyone else has run into the same issue and can give me some guidance? If you need more information let me know.
Other information
MySQL Version: 8.0.36
Mysql2 version: 3.9.7