怎么在mac中重置mysl8.0.11密码?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

1.启动mysql后正常登陆

2.查看sql中的root用户

selecthost,user,authentication_string,pluginfrommysql.user;+-----------+------------------+-------------------------------------------+-----------------------+|host|user|authentication_string|plugin|+-----------+------------------+-------------------------------------------+-----------------------+|localhost|mysql.infoschema|*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE|mysql_native_password||localhost|mysql.session|*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE|mysql_native_password||localhost|mysql.sys|*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE|mysql_native_password||localhost|root|*23AE809DDACAF96AF0FD78ED04B6A265E05AA257|mysql_native_password|+-----------+------------------+-------------------------------------------+-----------------------+4rowsinset(0.00sec)

3.重置密码

语法格式

selecthost,user,authentication_string,pluginfromuser;

plugin 密码加密方式

authentication_string 加密后的密码

注意 mysql8.0以后废弃了PASSWORD函数 添加密码的时候不需要使用函数

清空root密码

update user set authentication_string='你的密码' where mysql.user='root';

4.测试

mysql-uroot-p你的密码

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。