因为用的是MySQL 8.0.21的版本,所以密码规则和之前版本的不太一样。所以,在用项目中连接MySQL的时候,就抛了:
Current charset is UTF-8. If password has been set using other charset, consider using option ‘passwordCharacterEncoding’ 的异常。
我是用下面的方式解决的:
use mysql;
alter user 'username'@'%' identified with mysql_native_password by 'password';
解决MySQL8.0.21版本密码规则导致的连接异常
在使用MySQL8.0.21版本时,由于密码规则变化,尝试连接数据库出现了'CurrentcharsetisUTF-8.Ifpasswordhasbeensetusingothercharset,considerusingoption‘passwordCharacterEncoding’'的异常。通过执行`use mysql; alter user 'username'@'%' identified with mysql_native_password by 'password';`的SQL语句成功解决了问题。
1691

被折叠的 条评论
为什么被折叠?



