ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘localhost‘

mysql连数据库的时候报错:

1251 client does not support authentication protocol requested by server;consider upgrading Mysql client

ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'

先登录mysql

mysql -u root -p
输入密码

mysql> use mysql;
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| admin            | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
+------------------+-----------+
注意我的root,host是'%'

你可能执行的是:

 ALTER USER 'root'@'localhost' IDENTIFIED BY 'lrxAly0913';
改成:

 ALTER USER 'root'@'%' IDENTIFIED BY 'lrxAly0913';

posted @ 2022-08-11 18:49  码海兴辰  阅读(60)  评论(0编辑  收藏  举报