mysql8.0 重置密码 解决报错1045

青春壹個敷衍的年華 提交于 2020-02-22 12:25:20

全部用管理员运行cmd

1.net stop mysql

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

3.因为步骤2的操作正在占用cmd,重开一个cmd

4.新开的cmd中执行mysql

5.use mysql

6.update user set authentication_string = ''  where user='root' ; 

    string后面是两个单引号,把密码清空

7.quit

8.在之前的cmd中,Ctrl + C 停止cmd

9.net start mysql

10.新cmd中mysql -uroot -p , 按Enter, 出现“Enter password:” , 再按Enter

11.ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';      修改密码,注意结尾分号

12.quit

搞定!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!