balderdashy / balderdashy/sails
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol "caching_sha2_password"
- Dominant language
- JavaScript
- Stars
- 22.8k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
**Node version**: 16.16.0
**Sails version** _(sails)_: 1.5.2
**ORM hook version** _(sails-hook-orm)_: 2.1.1
**Sockets hook version** _(sails-hook-sockets)_: 2.0.0
**Organics hook version** _(sails-hook-organics)_:
**Grunt hook version** _(sails-hook-grunt)_: 4.0.0
**Uploads hook version** _(sails-hook-uploads)_:
**DB adapter & version** _(e.g. sails-mysql@5.55.5)_: 3.0.1
**Skipper adapter & version** _(e.g. skipper-s3@5.55.5)_: 0.8.7
**Mysql versión**: 8.0.34 community
when making a connection from an api rest project (backend) to a mysql database in version 8.0.34, it fails to establish a connection. The following error appears:
```
AdapterError: Unexpected error from database adapter: `count` failed ("badConnection"). A connection either could not be obtained or there was an error using the connection.
Additional data:
{
error: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Handshake.Sequence._packetToError (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket. (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/Connection.js:88:28)
at Socket. (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
--------------------
at Protocol._enqueue (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/www/wwwapp/testapi.ditdental.com/node_modules/mysql/lib/Pool.js:48:16)
at Object.getConnection (/www/wwwapp/testapi.ditdental.com/node_modules/machinepack-mysql/lib/get-connection.js:78:25)
at wrapper (/www/wwwapp/testapi.ditdental.com/node_modules/@sailshq/lodash/lib/index.js:3282:19)
at Deferred.parley.retry [as _handleExec] (/www/wwwapp/testapi.ditdental.com/node_modules/machine/lib/private/help-build-machine.js:1076:19)
at Deferred.exec (/www/wwwapp/testapi.ditdental.com/node_modules/parley/lib/private/Deferred.js:286:10)
at Deferred.switch (/www/wwwapp/testapi.ditdental.com/node_modules/machine/lib/private/help-build-machine.js:1469:16)
at spawnConnection (/www/wwwapp/testapi.ditdental.com/node_modules/sails-mysql/helpers/private/connection/spawn-connection.js:29:10)
at Object.spawnOrLeaseConnection (/www/wwwapp/testapi.ditdental.com/node_modules/sails-mysql/helpers/private/connection/spawn-or-lease-connection.js:23:3)
at Object.count (/www/wwwapp/testapi.ditdental.com/node_modules/sails-mysql/helpers/count.js:119:24)
at wrapper (/www/wwwapp/testapi.ditdental.com/node_modules/@sailshq/lodash/lib/index.js:3282:19)
at Deferred.parley.retry [as _handleExec] (/www/wwwapp/testapi.ditdental.com/node_modules/machine/lib/private/help-build-machine.js:1076:19)
at Deferred.exec (/www/wwwapp/testapi.ditdental.com/node_modules/parley/lib/private/Deferred.js:286:10)
at Deferred.switch (/www/wwwapp/testapi.ditdental.com/node_modules/machine/lib/private/help-build-machine.js:1469:16)
at Object.count (/www/wwwapp/testapi.ditdental.com/node_modules/sails-mysql/lib/adapter.js:331:16)
at Deferred._.extend._WLModel [as _handleExec] (/www/wwwapp/testapi.ditdental.com/node_modules/waterline/lib/waterline/methods/count.js:221:15)
at Deferred.exec (/www/wwwapp/testapi.ditdental.com/node_modules/parley/lib/private/Deferred.js:286:10)
at Deferred.tryCatcher (/www/wwwapp/testapi.ditdental.com/node_modules/bluebird/js/release/util.js:11:23)
at ret (eval at makeNodePromisifiedEval (/www/wwwapp/testapi.ditdental.com/node_modules/bluebird/js/release/promisify.js:184:12), :14:23)
at Deferred.toPromise (/www/wwwapp/testapi.ditdental.com/node_modules/parley/lib/private/Deferred.js:572:19)
at Deferred.then (/www/wwwapp/testapi.ditdental.com/node_modules/parley/lib/private/Deferred.js:431:22)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
},
meta: {
host: 'localhost',
port: 3306,
schema: true,
adapter: 'sails-mysql',
url: 'mysql://usr_ditdenta_test:****@localhost:3306/ditdenta_test',
identity: 'default'
}
}
at Object.find [as productgroup/find] (/www/wwwapp/testapi.ditdental.com/api/controllers/ProductGroupController.js:32:45)
at /www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/router/bind.js:236:53
at routeTargetFnWrapper (/www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/router/bind.js:395:9)
at Layer.handle [as handle_request] (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/layer.js:95:5)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/layer.js:95:5)
at /www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/index.js:335:12)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/index.js:275:10)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:127:14)
at alwaysAllow (/www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/hooks/policies/index.js:178:16)
at routeTargetFnWrapper (/www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/router/bind.js:395:9)
at Layer.handle [as handle_request] (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/layer.js:95:5)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/layer.js:95:5)
at /www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/index.js:335:12)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/index.js:275:10)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:127:14)
at Hook.expressMiddleware (/www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/hooks/i18n/index.js:205:14)
at Hook.wrapper [as expressMiddleware] (/www/wwwapp/testapi.ditdental.com/node_modules/@sailshq/lodash/lib/index.js:3282:19)
at addLocalizationMethod (/www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/hooks/i18n/index.js:147:35)
at routeTargetFnWrapper (/www/wwwapp/testapi.ditdental.com/node_modules/sails/lib/router/bind.js:395:9)
at Layer.handle [as handle_request] (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/layer.js:95:5)
at next (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/www/wwwapp/testapi.ditdental.com/node_modules/express/lib/router/route.js:112:3)
```
The user database is configured with "authentication" "caching_sha2_password"
Contributor guide
Research direction
Start by reproducing the connection from api/controllers/ProductGroupController.js:32 with MySQL 8.0.34 and the reported sails-mysql@3.0.1 setup. Then inspect the mysql client handshake and connection path shown in node_modules/mysql, machinepack-mysql, and sails-mysql; done means the reported authentication mode works or the supported configuration is clearly documented and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mysql, node.js
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100