node操作mysql報錯

2021-10-24 20:54:51 字數 667 閱讀 7504

我在學習用node連線資料庫時遇到了以下錯誤:

error: er_not_supported_auth_mode: client does not support

authentication protocol requested by server; consider upgrading mysql

client.

原因據網上說是因為mysql8.0+版本預設的密碼驗證方式是"caching_sha2_password",而node預設的驗證方式"mysql_native_password"。兩者驗證密碼的方式不同所以報錯。

開啟cmd,輸入以下命令

mysql -u root -p

輸入密碼連線mysql

輸入以下命令,修改驗證模式和密碼

alter user 「root」@「localhost」 identified with mysql_native_password by

「yourpassword」;

輸入以下sql語句,重新整理許可權,使修改立即生效。

flush privileges;

輸入exit退出mysql

mysql python操作mysql報錯處理總結

mysql python操作mysql報錯處理總結 錯誤 型別 pymysql.err.internalerror 1054,unknown column jack in field list 1 import pymysql 23 d mysql 11 conn pymysql.connect d...

Node學習03 Node操作mysql資料庫

cnpm install mysq運算元據庫 author your name date 2021 02 01 10 06 29 lastedittime 2021 02 01 10 24 11 lasteditors please set lasteditors description in us...

node下安裝Browsersync 報錯

npm err code eperm npm err errno 4048 npm err syscall scandir npm err please try running this command again as root administrator.開始的時候以為是管理員許可權的問題,各種...