请考虑如何使用--skip-grant-tables参数
用同样的方法,首先关闭系统服务
实测中,在mysql8系统下,可以在mysqld---- console---- skip-grant-tables---shared-memory中无需密码即可启动服务
服务启动后,使用空密码登录系统
mysql.exe -u root
然后运行sql命令将root用户的密码设置为空
update MySQL.usersetauthentication _ string=' where user=' root ' andhost=' localhost ';
具体操作截图
由于MySQL8的一些特性,导致无法顺利重置旧方法,建议使用--init-file参数进行解决,并进行安全性实测。