Centos7系统中Mysql登录忘记root密码

------------恢复内容开始------------

Centos7系统中Mysql登录忘记root密码

 

1.ront用户打开/etc/my.cnf(如果这个目录下没有my.cnf用find /* -name my.cnf 查找)

 

 

 2.用vim /etc/my.cnf打开后,在[mysql]下面一行写入

skip-grant-tables 

skip-name-resolve

主要让登录mysql加载配置mysql文件的时候绕过mysql用户验证.

如下图所示

 

 

 也可以这样写入

 

 3 mysql登录,修改mysql的root密码就好了.

 

 

------------恢复内容结束------------

posted @ 2020-06-02 22:35  wqx951  阅读(289)  评论(0编辑  收藏  举报