throw err// Rethrow non-MySQL errors

报错主要信息:

原因:

MySQL8.0.4以前MySQL的密码认证插件是

“mysql_native_password”,而现在使用的是“caching_sha2_password”。

解决方法:

// 进入mysql 输入密码例如:123456
mysql -u root -p 
 
// 1.执行语句 alter user 'root'@'localhost' identified with mysql_native_password by 密码;
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.43 sec)
 
// 2.再执行语句 flush privileges;
mysql> flush privileges;
Query OK, 0 rows affected (0.05 sec)
 
//3.成功后 退出
mysql> quit
Bye
 
nodejs环境重启下即可

猜你喜欢

转载自blog.csdn.net/m0_46461853/article/details/127233073
今日推荐