Processing method Linux centos7 mysql password forgotten

1, find the mysql configuration file to add the following configuration my.conf

#忽略验证
skip-grant-tables

Here Insert Picture Description

2, restart mysql

sudo systemctl restart mysql

3, it can be directly connected mysql connection

Here Insert Picture Description

4, change passwords

#选中mysql数据库
use mysql
#修改密码 这个可以根据你想修改的用户选择性修改 看你自己吧
update user set password=password('Xuan5201314) where user="root";

5, refresh permission, this step is very important

flush privileges;

6, delete the my.conf just added skip-grant-tables

7, the next restart mysql on the line

sudo systemctl restart mysql

8, difficulties can comment on (a letter will be back) Hsuan micro letter 17382121839

Published 47 original articles · won praise 57 · views 8857

Guess you like

Origin blog.csdn.net/qq_41741884/article/details/103993509