mysql8-root密码重置

本篇文件是window环境的mysql8的root密码重置

1、关闭mysql服务

    net stop mysql

2、通过没有登录认证的方式启动mysql

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

3、重置密码

    1)登录mysql

mysql -u root -p

不输入密码直接登录

use mysql

    2)查看root的密码是否为空,如果不为空,执行如下,如果为空,直接执行3)
select user,authentication_string from user;

update user set authentication_string='' where user='root';

    3)如果上面2)步骤执行查询出来为空,执行如下:
ALTER user 'root'@'localhost' IDENTIFIED BY 'Firedinner123#';    --密码要最少8位+大写字母+小写字母+数字

4、报错情况

    如果在执行3-3时出现如下错误,需要刷新回收站:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
flush privileges;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值