mysql8之前连接加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password
解决问题方法:把mysql用户登录密码加密规则还原成mysql_native_password
1、登录mysql8
mysql -u root -p
2、修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
3、刷新权限
FLUSH PRIVILEGES;
4、再次连接