原因:mysql登录验证的默认插件变更,从mysql_native_password变为caching_sha2_password。
1.输入密码进入数据库
mysql -u root -p
SHOW DATABASES;
use mysql;
进入mysql数据库
2、修改加密规则:
ALTER USER 'root'@'localhost' IDENTIFIED BY '修改的密码' PASSWORD EXPIRE NEVER;
3、使用mysql_native_password认证插件:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '修改的密码';
4、刷新权限:
FLUSH PRIVILEGES;
5、重置密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码'
6、刷新权限
FLUSH PRIVILEGES;
7、查看身份验证插件
SELECT Host, User, plugin from user;
过程
网友评论