Mysql 8.0 密码修改

Mysql 8.0 密码修改

  1. 停止mysql服务

    net stop mysql 
    
  2. 跳过权限认证启动mysql服务

    mysqld --console --skip-grant-tables --shared-memory
    
  3. 打开一个新的cmd窗口,启动mysql服务

    net start mysql
    
  4. 输入密码直接空格键跳过

    mysql -u root -p
    
  5. 使用msyql库

    use mysql;
    
  6. 将密码置空

    update user set authentication_string='' where user='root';
    
  7. 关闭mysql服务(直接关闭窗口即可)

  8. 重新开启mysql服务,可以无密码登陆了

  9. 修改密码

    alter user'root'@'localhost' identified by '123456';
    
  10. 刷新权限认证

    flush privileges;
    
  11. exit

posted @ 2021-12-07 15:32  dldream  阅读(95)  评论(0)    收藏  举报