使用MySQL客户端Navicat连接数据库MySQL8.0,MySQL8.0 之前的版本中加密规则是mysql_native_password,而MySQL8.0,加密规则是caching_sha2_password
在DOS下登录mysql,再执行以下代码即可:
alter
user 'root'@'localhost'
identified by
'新密码'
password expire never;
alter
user 'root'@'localhost'
identified with mysql_native_password by
'新密码';