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 |
| zhangj           | localhost |
+------------------+-----------+
  • 注意個人root,host是'%'
  • 你可能執行的是:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';
  • 改爲:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
相關文章
相關標籤/搜索