微信登录

Mysql - 忘记密码

Mysql - 忘记密码

Winodws

关掉mysql:
我的电脑(此电脑) - 右键 - 管理 - 服务和应用程序 - 服务 - 停止

  1. 管理员命令cmd
  2. cd mysqlbin路径,上面管理 - 右键属性
  3. mysqld --skip-grant-tables 免密启动
  4. 新开管理员命令:
  5. mysql -uroot -p
  6. 直接回车
  7. use mysql;
  8. update user set authentication_string='' where user='root'; 删掉密码
  9. quit 退出
  10. 新开管理员命令:
  11. tasklist mysqld.exe的端口号
  12. taskkill /f /pid 123123 杀掉
  13. 开启mysql
  14. 我的电脑(此电脑) - 右键 - 管理 - 服务和应用程序 - 服务 - 启动
  15. 新开命令:
  16. mysql -u root -p
  17. ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxx'; xxx为密码
Mysql - 忘记密码