mysql重置密码

1. net stop mysql

2. D:回车,cd D:\mysql-8.0.12-winx64\bin,输入mysqld --console --skip-grant-tables --shared-memory

3. 重新打开一个管理员cmd,mysql -uroot -p

4. mysql> UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';  //密码置空

flush privileges;  #刷新系统授权表

 

grant all on *.* to 'root'@'localhost' identified by '123456' with grant option;

alter user 'root'@'localhost' identified by '123456' ;

 

5. 重新打开一个管理员cmd,net start msyql,mysql -uroot -p,ok

如果无法启动:

进入命令行(管理员身份):(进入 MySQL安装的 bin 目录下) 
1、 mysqld --initialize (检查目录下存在 data 文件夹,删除即可) 

2、net start mysql

 如果无法启动:

打开控制面板:服务管理,点击mysql服务的启动按钮

posted @ 2020-03-07 10:55  bhuiwan  阅读(119)  评论(0)    收藏  举报