“code”:”ER_NOT_SUPPORTED_AUTH_MODE”,”errno”:1251,”sqlMessage”:”Client does not support authentication protocol requested by server – Solved

Error:

{"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}

Solution->

To solve the above error, just install mysql2 package instead of mysql. To install mysql2 just follow the following command:-

npm install --save mysql2

Now, where you are importing mysql module, replace mysql with mysql2.

for example

replace

const mysql = require("mysql");

with

const mysql = require("mysql2");

Restart the NodeJs Server and see the magic.

Leave a Reply