原文链接:
https://www.bbsmax.com/A/Gkz1qLprzR/
https://blog.csdn.net/xiuxiuzhuanshu/article/details/113309076
报错信息如下:
原因:
mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password。
解决办法:
命令行连接mysql:
mysql -uroot -ppassword
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限并重置密码
alter user 'root'@'localhost' identified by 'newPassword';