Client does not support authentication protocol requested by server

Client does not support authentication protocol requested by server

也适用于 Operation ALTER USER failed for '用户名'@'主机'  ...  ; (当然前提是密码方面的问题)

本机是mysql8

原因:mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password

先登入数据库 

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';#更新一下用户的密码这里的password为修改的新密码。

FLUSH PRIVILEGES; #刷新权限,修改生效。

 

###!!!!!如果更改后用密码不能登录 尝试先把密码置空  再flush privileges 再设置 再flush privileges;

mysql> update user set authentication_string ='' where user='yuan' and host='%';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

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

mysql> alter user 'yuan'@'%' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.00 sec)

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

mysql> exit

 然后就能登陆了

posted @ 2021-04-02 13:44  TIFOSI_Z  阅读(44)  评论(0编辑  收藏  举报