侧边栏壁纸
博主头像
SeaDream乄造梦

Dream,Don't stop a day of hard and don't give up a little hope。 ——不停止一日努力&&不放弃一点希望。

  • 累计撰写 40 篇文章
  • 累计创建 20 个标签
  • 累计收到 13 条评论

目 录CONTENT

文章目录

mysql 5.7和mysql 8.0 忘记密码的解决方案

SeaDream乄造梦
2022-04-30 / 0 评论 / 0 点赞 / 453 阅读 / 634 字
温馨提示:
亲爱的,如果觉得博主很有趣就留下你的足迹,并收藏下链接在走叭

mysql 8忘记密码,修改密码

进入安装目录

image-20220430145106738

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

另外管理员身份打开一个黑窗口,依次执行以下命令

mysql -u root
use mysql;
flush privileges;
update user set authentication_string='123456' where user='root';
alter user 'root'@'localhost' identified by '123456';
flush privileges;
quit;

image-20220430145411311

关闭两个窗口,启动服务,输入新密码,进入成功

image-20220430145508190

mysql 5.7忘记密码,修改密码

步骤类似:

  1. 管理员身份启动黑窗口,进入安装目录

  2. 关闭服务,跳过登录授权

    net stop mysql
    
    mysqld --skip-grant-tables
    
  3. 管理员身份启动另一个黑窗口,进入安装目录,依次输入

    mysql
    
    use mysql 
    
    update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost'; update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost'; (其中123456为你要重置的密码)
    
    FLUSH PRIVILEGES;
    
    quit;
    
0

评论区