最近新买了电脑,再重新安装mysql过程中,发现user字段没有了password字段,update root密码失败,发现最新版本更新为authentication_string,然后update user set authentication_string=‘123456’ where user=‘root’;
免登录之后发现authentication_string已变为123456,然而去除免密重启之后一直1045,后来发现没有用到mysql的加密函数,实际应该使用update user set authentication_string=password(‘123456’) where user=‘root’;调用mysql的password函数。

本文分享了在MySQL中更新root用户密码时遇到的问题及解决方案。作者在尝试更新root密码时发现user表中password字段已被替换为authentication_string,直接设置字符串作为密码导致1045错误。最终通过调用mysql的password函数正确更新了密码。

958

被折叠的 条评论
为什么被折叠?



