A
A
Alexander Koshelev2018-08-13 23:28:29
MySQL
Alexander Koshelev, 2018-08-13 23:28:29

How to fix mysql_native_password error?

Good evening everyone!
I create a Web application with authorization on Node.js + Passport.js + Sequelize with Mysql dialect
The essence of the problem is as follows: I
created a file to import all models from the models folder, I add the following code to the main project file

models.sequelize.sync().then(function() {
    console.log('All good')
}).catch(function(err) {
    console.log(err, "Where is wrong")
});

I run the file and everything is guuud.
Next, I create a User model that will contain information about them, the user model file is also in the models folder, I run it and get the following error
{ SequelizeConnectionError: Client does not support authentication protocol requested by server; consid
er upgrading MySQL client

    at Utils.Promise.tap.then.catch.err (C:\node.js\tests\sequelize\node_modules\sequelize\lib\dialects
\mysql\connection-manager.js:149:19)
    at tryCatcher (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\p
romise.js:512:31)
    at Promise._settlePromise (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\promise.js:5
69:18)
    at Promise._settlePromise0 (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\promise.js:
614:10)
    at Promise._settlePromises (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\promise.js:
689:18)
    at Async._drainQueue (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\node.js\tests\sequelize\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\node.js\tests\sequelize\node_modules\bluebird\
js\release\async.js:17:14)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
  name: 'SequelizeConnectionError',
  parent:
   { Error: Client does not support authentication protocol requested by server; consider upgrading MyS
QL client
    at Packet.asError (C:\node.js\tests\sequelize\node_modules\mysql2\lib\packets\packet.js:714:13)
    at ClientHandshake.Command.execute (C:\node.js\tests\sequelize\node_modules\mysql2\lib\commands\com
mand.js:28:22)
    at Connection.handlePacket (C:\node.js\tests\sequelize\node_modules\mysql2\lib\connection.js:513:28
)
at PacketParser.onPacket (C:\node.js\tests\sequelize\node_modules\mysql2\lib\connection.js:81:16)
    at PacketParser.executeStart (C:\node.js\tests\sequelize\node_modules\mysql2\lib\packet_parser.js:7
6:14)
    at Socket.<anonymous> (C:\node.js\tests\sequelize\node_modules\mysql2\lib\connection.js:89:29)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
    at TCP.onread (net.js:581:20)
     code: 'ER_NOT_SUPPORTED_AUTH_MODE',
     errno: 1251,
     sqlState: '08004',
     sqlMessage: 'Client does not support authentication protocol requested by server; consider upgradi
ng MySQL client' },
  original:
   { Error: Client does not support authentication protocol requested by server; consider upgrading MyS
QL client
    at Packet.asError (C:\node.js\tests\sequelize\node_modules\mysql2\lib\packets\packet.js:714:13)
    at ClientHandshake.Command.execute (C:\node.js\tests\sequelize\node_modules\mysql2\lib\commands\com
mand.js:28:22)
at Connection.handlePacket (C:\node.js\tests\sequelize\node_modules\mysql2\lib\connection.js:513:28
)
    at PacketParser.onPacket (C:\node.js\tests\sequelize\node_modules\mysql2\lib\connection.js:81:16)
    at PacketParser.executeStart (C:\node.js\tests\sequelize\node_modules\mysql2\lib\packet_parser.js:7
6:14)
    at Socket.<anonymous> (C:\node.js\tests\sequelize\node_modules\mysql2\lib\connection.js:89:29)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
    at TCP.onread (net.js:581:20)
     code: 'ER_NOT_SUPPORTED_AUTH_MODE',
     errno: 1251,
     sqlState: '08004',
     sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client' } } 'Wrong'

Until the end, I can’t understand what’s what, I kind of used it on the forums, but I didn’t find anything suitable for me, the problem, as I understand it, is in the authorization and password. I use regular mysql for Windows 10, in node.js I use the mysql2 npm package, when I run the code that I initially indicated above, before everything worked, it first asked me to use mysql2 and not mysql.
Please help, who can, it's very difficult for me ((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2018-08-14
@Xandr24

So do you want to use Native Pluggable Authentication or not?
If you want, then update the client (Node.js + Passport.js + Sequelize) to support it.
If you do not want, then configure MySQL with a different authorization.
https://dev.mysql.com/doc/refman/5.7/en/pluggable-...
https://dev.mysql.com/doc/refman/5.7/en/server-sys...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question