本文最后更新于872 天前,其中的信息可能已经过时,如有错误请评论留言
远程连接MySQL报错
报错内容:Client does not support authentication protocol requested by server; consider upgrading MySQL client
报错原因:MySQL8.0以后的版本加密方式与之前不同,8.0.11换了新的身份验证插件:caching_sha2_password,以前的为mysql_native_password
解决方法:
1. 登录数据库后,查看'root'用户身份验证插件:
* use mysql;
* select user,plugin,host from user where user='root';
2. 改变身份验证插件(加密方式)
- alter user 'root'@'localhost' identified with mysql_native_password by '277882';
3. 最后重新查看加密方式(身份验证插件)
- select user,plugin from user where user='root';
node-express报错
报错内容:expressJWT is not a function
报错原因:express高版本代码书写与过去低版本不同,新版需要配置algorithms算法,一般默认值为HS256
解决方法:
- 代码改成:
app.use(expressJWT.expressjwt({ secret: secretKey, algorithms: ["HS256"] }).unless({ path: [/^\/api\//] }))