使用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
'新密碼';