alter user 'root'@'%' identified with mysql_native_password by '123456'; ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%'
时间: 2023-08-31 13:08:12 浏览: 193
根据引用中的内容,由于发现了host列的值是'%',所以修改密码语句应该改为:ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxxx'; flush privileges; 这样才能成功修改密码。而根据引用中的内容,执行语句修改MySQL root密码应该为:ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxx'; 由于报错信息为ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost',说明修改用户密码的操作失败了。所以解决这个问题的方法就是按照引用中的方式,将ALTER USER语句中的localhost替换成%,即ALTER USER 'root'@'%' identified with mysql_native_password by '123456'; 这样就可以成功修改密码了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [MySQL修改密码报错ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘localhost](https://blog.csdn.net/u012069313/article/details/123051399)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文