mysql管理员账号root密码忘记了怎么办

it2023-04-03  77

###################更改 Mysql root用户密码 ################# [roor@localhost ~]# vi /etc/my.cnf server-id = 1 #####下面插 skip-grant-tables skip-grant-tables #####跳过密码验证

systemctl restart mysqld

这样可以直接mysql进入数据库

给root用户设密码 update mysql.user set authentication_string=PASSWORD(‘abc123’) where User=‘root’;

刷新 flush privileges;

完后,将免密码模式该回来 vi /etc/my.cnf server-id = 1 #####下面去掉 skip-grant-tables #skip-grant-tables 此行删除或注释掉

最新回复(0)