# systemctl stop mysqld
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# vim /etc/my.cnf.d/mysql-server.cnf
[mysqld]
skip-grant-tables
skip-networking
[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]# mysql
mysql> USE mysql;
mysql> update user set authentication_string='' where user='root';--将字段authentication_string置为空
mysql> FLUSH PRIVILEGES;
mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'Qq111111.';--修改密码为123456
mysql> \q
Bye
[root@localhost ~]# systemctl restart mysqld
07-23
1007
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-24
789
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-25
716
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)