Crack the mysql database password
1. Enter the main database configuration file
[root@localhost ~]# vim /etc/my.cnf
Add skip-grant-tables in the fifth line
2. Restart the database service
[root@localhost ~]# systemctl restart mysqld
3. Enter the database
[root@localhost ~]# mysql
-------------------5.7 version is suitable for the following commands----------------
mysql> use mysql;
mysql> update user set
-> authentication_string=password('ABCabc@123') where user='root';
mysql> flush privileges; //刷新
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'ABCabc@123';
mysql> \q //退出数据库
4. Restart the database service
[root@localhost ~]# systemctl restart mysqld
5. Enter the main database configuration file
[root@localhost ~]# vim /etc/my.cnf
Add a note before skip-grant-tables
6. Restart the database service
[root@localhost ~]# systemctl restart mysqld
Finished, the password has been changed to ABCabc@123