进入mysql控制台查询
select host,user,plugin,authentication_string from mysql.user;
根据自己的连接情况修改。
在mysql8之前的版本中加密规则为mysql_native_password
而在mysql8以后的加密规则为caching_sha2_password。
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限