mysql8.0.26忘记密码后重置(centos8)

 1、查看配置文件地址

mysql --help|grep 'my.cnf'

2、编辑/etc/my.cnf配置文件

vim /etc/my.cnf

 增加跳过密码配置

[mysqld]
skip-grant-tables

 3、重启mysql

service mysqld restart

 4、修改密码

use mysql;
update user set authentication_string='' where user='root';
FLUSH privileges;

 修改密码后,修改配置文件(注释跳过登录)后,重启MySQL服务。

 登录验证,可修改为其他密码

use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY "12345678";
FLUSH privileges;

 

 

Guess you like

Origin blog.csdn.net/qq_29752857/article/details/131372732