小白尝试使用Javascript语言连接MySQL数据库,结果出现了如下错误:
[SELECT ERROR] - ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
查阅网上资料,看到如下解决办法,所以来记录一下。
解决方法:
root
,password:root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRENEVER;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '修改自己的密码';
我用到的命令如下:
mysql -u root -p Enter password: root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
参考博客地址: https://www.cnblogs.com/tourey-fatty/p/12522784.html