ER_NOT_SUPPORTED_AUTH_MODE - MySQL server ER_NOT_SUPPORTED_AUTH_MODE - MySQL server javascript javascript

ER_NOT_SUPPORTED_AUTH_MODE - MySQL server


For now 8.0 version is way to change plugin :Use this example:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'


enter image description here

Do Reconfigure Authentication Method,there you select legacy type password support for 5.1

Reason for the error

*You Installed latest Mysql 8.0 ,it has deferent authentication method. degrading 5.6 or 5.1 is simple solution


The top-rated answers in this Q/A thread are for the most part accurate/valid, but unorganized to say the least. A solution is here, however; the solution is pieces and bits found amongst three answers. To offer an answer and solution that exist in a single post is easier to read, interpret, and all-around more helpful and a time saver, I will make an attempt to answer the question with a clear, concise, and orderly set of instructions that covers the whole Problem that Ubuntu users are experiencing. In addition, I will add information necessary, not included in other answers, for understanding the issue being solved. Like that the problem is not a SQL problem it is an Ubuntu. To bring clarity to readers, of what the problem in persistence is; the 'ROOT' user doesn't have a password in Ubuntu. Ubuntu users use the sudo command, and organize authority through the permission of use of the sudo cmd for pretty much everything, there are exceptions and there is a Ubuntu Root User option, but it doesn't help to discuss those things right here, right now. The important thing to note is the following:

  • Ubuntu lacks a 'ROOT PASSWORD' and this is why everyone experiencing the issue that we are discussing runs a Distribution of the Ubuntu OS/SHELL. We cannot give Ubuntu SHELL a 'ROOT PASSWORD', however, we can, and we are, going to give a 'ROOT PWD' to our 'MYSQL-COMMUNITY-SERVER'.

Firstly you need NPM, NodeJS, MySql, and NPM's MySql Driver. If you don't already have them you shouldn't even be reading this, because your cant even know 100% if the issue you are solving is this...

...If you do have everything on the list, and are running a Ubuntu dist., and are getting error authentication messages and Connection err messages that look like the following

  • ERROR: (28000): Access denied for user 'ajc'@'localhost'
  • ERROR: ERROR_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
  • 'Client does not support authentication protocol requested by server; consider upgrading MySQL client

Then you are likely in the right place.

  • To solve the problem start by creating an Empty 'dot JS' file for testing, call it 'sqltest.js' or whatever you like.

  • Add the CODE bellow to it.

  • In the method called 'createConnection' is a JSON OBJ parameter holding the credential values to make a valid connection to the MySql database server. The user has to equal to 'root', and the database has to exist. Also for a later test add a testing table to the database, with some BS data."

let mysql = require('mysql');let connection = mysql.createConnection({    host     : 'localhost',    user     : 'root',    password : '********',    database : 'DB_App_00',});connection.connect(function(err) {    if (err) {      return console.error('error: ' + err.message);    }      console.log('Connected to the MySQL server.');  });

Now open a terminal window, and do your typical updates & upgrades, this is important, which is why every tut asks you to do them.

~$: sudo apt update~$: sudo apt upgrade

let connection = mysql.createConnection({host : 'localhost',user : 'root',password : '********',database : 'DB_App_00',});

Now type the following cmd

~$: sudo mysql -u root
  • It should prompt you for your Ubuntu Password, type it and [ENTER].

Now here is the step that could be considered the medicine and/or the cure to the problem. Your terminal should be open, and you should be inside of the MYSQL Server, under the user 'root'. The terminal should have the cursor flashing at a blank mysql command-line. Within the CMDL copy & paste this:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'ChoosePassword';mysql> FLUSH PRIVILEGES;
  • The next part is obvious, change 'ChoosePassword' to a password you will remember while leaving the password within single quotation marks. Change absolutely nothing else, press [ENTER]

  • If you followed the steps correctly, you now have a MySQL 'ROOT USER' with its own password now. Test it by copy and paste the following at the Ubuntu CMDL:

 ~$: mysql -u root -p 
  • It will prompt you for your new password, type it and [ENTER]

...you should be in, now exit.

mysql>exit
  • Back to your 'testsql.js' file, alter the credentials to root for the user, password to your password, a valid database, and host to localhost, unless you have a unique need for a different hostname.
let connection = mysql.createConnection({    host     : 'localhost',    user     : 'root',    password : '********',    database : 'DB_App_00',});

now use node to run the node test file

~$: node testsql.js

If it doesn't say connected you did something wrong, but if all went well, you should connect. It took some effort before I got it to work, but this answer should save you some time from reading all the other half written answers.