Question

How to setup mysql 8.0 connection with adonis JS application with latest version?

Posted June 19, 2021 1k views
UbuntuMySQLNode.jsDatabasesUbuntu 20.04

The command that I am running is:

user@user-Vostro-3558:~/Desktop/company/projects/saturdatTest$ adonis 
migration:run

The error that I’m getting is:

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Handshake.ErrorPacket (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
    at Protocol._parsePacket (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (events.js:375:28)
    at addChunk (internal/streams/readable.js:290:12)
    --------------------
    at Protocol._enqueue (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at Connection.connect (/home/user/Desktop/company/projects/saturdatTest/node_modules/mysql/lib/Connection.js:116:18)
    at /home/user/Desktop/company/projects/saturdatTest/node_modules/knex/lib/dialects/mysql/index.js:68:18
    at new Promise (<anonymous>)
    at Client_MySQL.acquireRawConnection (/home/user/Desktop/company/projects/saturdatTest/node_modules/knex/lib/dialects/mysql/index.js:63:12)
    at create (/home/user/Desktop/company/projects/saturdatTest/node_modules/knex/lib/client.js:290:39) {
  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
}
edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

As the error indicates that the authentication mode is not supported, what I could suggest is to change your authentication mode from caching_sha2_password to mysql_native_password.

You can follow the steps on how to do that here:

https://www.digitalocean.com/community/questions/how-to-change-caching_sha2_password-to-mysql_native_password-on-a-digitalocean-s-managed-mysql-database

Let me know how it goes!
Regards,
Bobby