mysql8修改密码正确方式

今天第一次使用mysql8.0版本,使用之前在mysql5.7版本修改密码命令报错

update user set authentication_string = password("root") where user = "root";

微信截图_20210707152757.jpg

然后经过翻阅资料发现mysql 5.7.9以后废弃了password字段和password()函数;authentication_string:字段表示用户密码,而authentication_string字段下只能是mysql加密后的41位字符串密码

所以有了新的修改密码的方式,用以下命令

alter user "root"@"localhost" identified by "admin";

微信截图_20210707152926.jpg

最后别忘记刷新权限

flush privileges;

这样就修改好了

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://sulao.cn/post/777.html

我要评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。