MySQL 忘记root密码重置

1.停止mysql服务

# 停止服务
systemctl stop mysqld

# my.conf文件增加一行
[mysqld]
skip_grant_tables

# 重启服务
systemctl start mysqld

# 登陆mysql
mysql


# 重置root用户密码,并刷新权限
update mysql.user set authentication_string=password('pinxxxxxxx3')   where user='root' and host='localhost';
flush privileges;

# 退出去掉my.conf文件中的skip_grant_tables


# 重启mysql服务
systemctl start mysqld


# 重置成功

 https://www.cnblogs.com/zgqbky/p/11720406.html

posted @ 2020-08-26 11:27  sunmmi  阅读(57)  评论(0)    收藏  举报