当前位置:   article > 正文

解决方案:ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘localhost‘。_operation alter user failed for 'root'@'localhost

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;
  1. +------------------+-----------+
  2. | user | host |
  3. +------------------+-----------+
  4. | root | % |
  5. | admin | localhost |
  6. | mysql.infoschema | localhost |
  7. | mysql.session | localhost |
  8. | mysql.sys | localhost |
  9. | zhangj | localhost |
  10. +------------------+-----------+

注意我的root,host是'%'

你可能执行的是:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';

改成:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/535664
推荐阅读
相关标签
  

闽ICP备14008679号