mysql8.0版本忘记root密码

Posted twodoge

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql8.0版本忘记root密码相关的知识,希望对你有一定的参考价值。

1、先关掉系统服务

net stop mysql

2、进入mysql安装目录的bin文件中,以管理员的方式运行cmd,然后输入如下命令,实现无密码登陆

mysqld --console --skip-grant-tables --shared-memory

3、以空密码登入系统

mysql.exe -u root

4、重置密码

UPDATE mysql.user SET authentication_string='root' WHERE user='root' and host='localhost';

5、ok

以上是关于mysql8.0版本忘记root密码的主要内容,如果未能解决你的问题,请参考以下文章