errno: 1251, sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client
once you establish you host, root, password &, etc inside your MySQL connection function.. paste the following inside of your database you are trying to connect within workbench the following:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_current_password';
Go back to the terminal and run node <file name.js>
again
Open terminal and login:
mysql -u root -p
(then type your password)
After that:
USE mysql;
UPDATE user SET authentication_string=password(''), plugin='mysql_native_password' WHERE user='root';
And the last important thing is to reset mysql service:
sudo service mysql restart
You have to reconfigure MySQL Server. for that follow these steps.
1) Open mysql intsaller.
2) Click on Reconfigure (to the left mysql server)
3) Go to Authentication method tab (by clicking on Next twice.)
4) Then select the radio button Use Legacy Authentication Method. Click Next.
5) Enter your password. Click on Check. Go to Apply Configuration (by clicking on Next twice).
6) Click on Execute. Then Finish.
That's it. Enjoy Hacking!!