node MySql8.0 ER_NOT_SUPPORTED_AUTH_MODE 問題

在 node 環境下運行 mysql 因爲版本不兼容會報以下錯誤:node

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL clientmysql

...sql

code: 'ER_NOT_SUPPORTED_AUTH_MODE',npm

errno: 1251,ide

sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',code

其餘博客會告訴你, 因爲 nodejs 和 mysql 8.0 版本 不兼容什麼的, 改這個server

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '一堆可能不生效的代碼';
flush privileges;
 
可是我這裏不奏效,索性
npm i mysql8.0 -S
搞定!!!
 
轉載隨筆/文章請保留出處和署名,謝謝!!
相關文章
相關標籤/搜索