Can
Be Better

Centos6 重置Mysql 8.0 root密码

编辑Mysql配置文件/etc/my.cnf

 

nano /etc/my.cnf

找到[mysqld],在下面添加一行skip-grant-tables

 

 

重启MySQL

service mysqld restart

root用户登录MySQL,提示密码直接回车

mysql -u root -p

 修改root密码,并刷新权限

update mysql.user set authentication_string=password(‘新密码’) where user=’root’ and host=’localhost’;
flush privileges;

退出MySQL,注释掉my.cnf中的skip-grant-tables

重启MySQL

service mysqld restart

 

赞(0) 打赏
不开启评论,如有问题疑问请发邮件。[email protected]最长的路 » Centos6 重置Mysql 8.0 root密码
分享到: 更多 (0)