【MySQL】密码重置

  1. 管理员启动cmd,输入"net stop mysql"关闭mysql服务
  2. 修改mysql安装路径下的配置文件 my.ini,在 [mysqld] 后添加"skip-grant-tables" 【MySQL】密码重置
  3. 启动mysql服务,net start mysql
  4. 登录root用户:mysql -uroot -p
  5. 修改密码,依次输入:
    use mysql;
    update user set authentication_string = password(‘12345’) where user = ‘root’;
    (这里的12345为新密码)
  6. 输入 \q 退出mysql
  7. 关闭mysql服务,删除 skip-grant-tables
  8. 启动mysql服务,用新密码登录