node連接Mysql報錯:Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication .......

報錯提示

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol request
ed by server; consider upgrading MySQL client

報錯原因:mysql8.0以上加密方式,Node還不支持。

解決方案

打開MySql命令行終端輸入;【1234是我本地登錄MySql的賬號】

alter user 'root'@'localhost' identified with mysql_native_password by '1234';
flush privileges;

然後就解決了,如果不行的話就下載個低版本的mysql。

【補充:】

flush privileges 命令本質上的作用是將當前user和privilige表中的用戶信息/權限設置從mysql庫(MySQL數據庫的內置庫)中提取到內存裏。經常用在改密碼和授權超用戶。

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章