mysql_8.0 连接caching_sha2_password错误

mysql5.8从开始将caching_sha2_password作为默认的身份验证插件,而在MySQL 5.7中,默认的身份验证插件是 mysql_native_password!

image.png

这个时候可以修改 user 表中的密码规则,回到mysql5.7的密码验证格式。

1、切换到 mysql 数据库
use mysql;
2、修改用户密码规则及新密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new password';
3、刷新数据库

FLUSH PRIVILEGES;

如果alter user执行报错,原因是由于root用户没有SYSTEM_USER权限,把权限加入后即可解决:
grant system_user on . to 'root';
再重新执行授权即可。


mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> grant system_user on *.* to 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER USER 'adminV1'@'%' IDENTIFIED WITH mysql_native_password BY 'Nszx!617N252';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

你可能感兴趣的:(mysql_8.0 连接caching_sha2_password错误)