mysql忘记密码

kill掉mysql进程

启动mysql

bin/mysqld --skip-grant-tables

免密码登陆

mysql -uroot -p

修改密码

use mysql;
update user set authentication_string = password ('new-password') where user = 'root';

登录时提示密码过期

ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

修改免密码登陆后查询密码是否过期

select host,user,password_expired,account_locked from mysql.user;

Y 说明密码过期 修改为N

update mysql.user set password_expired='N';


mysql忘记密码
https://www.hechunyu.com/archives/mysqlwang-ji-mi-ma
作者
chunyu
发布于
2021年08月30日
许可协议